| Extracted from Pike v7.8 release 866 at 2018-02-09.

[Top]
Protocols
Protocols.HTTP

# Method Protocols.HTTP.uri_encode()

Method uri_encode

  `string uri_encode(string s)`

Description

  Encodes the given string using `%XX` encoding to be used as a component part in a URI. This means that all URI reserved and excluded characters are encoded, i.e. everything except `A-Z`, `a-z`, `0-9`, `-`, `.`, `_`, and `~` (see RFC 2396 section 2.3).

  8-bit chars and wider are encoded using UTF-8 followed by percent-encoding. This follows RFC 3986 section 2.5, the IRI-to-URI conversion method in the IRI standard (RFC 3987) and appendix B.2 in the HTML 4.01 standard. It should work regardless of the charset used in the XML document the URI might be inserted into.

See also

  uri_decode , uri_encode_invalids , iri_encode