← index

[Web]Url

inherits Object · defined at web/00-url.qn:21

The URL percent codec: component encoding/decoding plus query- and form-string parsing — pure class-side functions, no network.

[Web]Url.encode:'a b/c'                 "* -> a%20b%2Fc
[Web]Url.decode:'h%C3%A9llo'            "* -> héllo
[Web]Url.queryParse:'a=1&b=two&flag'    "* -> #{'a': '1' 'b': 'two' 'flag': ''}
[Web]Url.formDecode:'q=a+b%2Bc'         "* -> #{'q': 'a b+c'}

Class methods

decode:

Decode %XX escapes (case-insensitive hex); every other byte passes through, and the result is read as UTF-8. '+' is NOT special here — that is form decoding (formDecode:). A truncated or non-hex escape, or invalid UTF-8, throws ValueError.

web/00-url.qn:41

decodeComponent: plusAsSpace:

Decode one query/form component: '+' -> space first (when asked — so an escaped %2B still decodes to a literal plus), then the %XX pass.

web/00-url.qn:93

encode:

Percent-encode s as a URL component: unreserved characters (RFC 3986 ALPHA / DIGIT / '-' / '.' / '_' / '~') pass through, every other UTF-8 byte becomes %XX (uppercase hex).

web/00-url.qn:26

formDecode:

application/x-www-form-urlencoded: like queryParse:, but '+' decodes to a space (in keys and values both).

web/00-url.qn:71

hexDigit:

The value of one hex-digit byte; a non-hex byte throws ValueError.

web/00-url.qn:105

parse: plusAsSpace:

Internal: the shared query/form parser — split on '&' and '=', decode each side through decodeComponent:plusAsSpace:.

web/00-url.qn:75

queryParse:

Parse a query string ('a=1&b=two&flag') into a Map: keys and values percent-decoded, a bare key mapping to '', a repeated key keeping the LAST value, empty segments ignored. '+' stays a literal plus.

web/00-url.qn:67

unreserved?:

RFC 3986 unreserved byte?

web/00-url.qn:98