PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

HttpService UrlEncode

HttpService UrlEncode

Sep 27 2018, 2:02 AM PST

This code sample uses UrlEncode to turn a string into a safe, percent-encoded string that can be used in a URL as an argument. Notice how only unreserved characters (letters, numbers and -_.~) are not transformed into percent-encoded equivalents. Characters with accents are also transformed (for example é is transformed into %C3).

local HttpService = game:GetService("HttpService")
local content = "Je me suis allé au cinema." -- French for "I went to the movies"
local result = HttpService:UrlEncode(content)
print(result) --> Je%20me%20suis%20all%C3%A9%20au%20cinema%2E