Percent-encodes a string.
When spaceIsPlus is true, spaces are encoded as + (common in
application/x-www-form-urlencoded form data). Otherwise spaces are
encoded as %20.
@eryx/encoding/url ModuleURL percent-encoding utilities.
Encodes and decodes strings using percent-encoding as defined by
RFC 3986. Unreserved characters (A–Z, a–z, 0–9, -, _, ., ~)
are left untouched; all others are replaced with %XX hex sequences.
local url = require("@eryx/encoding/url")
print(url.encode("hello world", true)) -- "hello+world"
print(url.encode("hello world", false)) -- "hello%20world"
Percent-encodes a string.
When spaceIsPlus is true, spaces are encoded as + (common in
application/x-www-form-urlencoded form data). Otherwise spaces are
encoded as %20.
The string to encode.
Whether to encode spaces as +.
The percent-encoded string.
Decodes a percent-encoded string.
When plusIsSpace is true, + characters are decoded as spaces
(matching application/x-www-form-urlencoded form data).
The percent-encoded string.
Whether to decode + as a space.
The decoded string.