Pike v8.1 release 6

Method Protocols.HTTP.percent_encode()


Method percent_encode

string percent_encode(string s)

Description

Encodes the given string using %XX encoding, except that URI unreserved chars are not encoded. The unreserved chars are A-Z, a-z, 0-9, -, ., _, and ~ (see RFC 2396 section 2.3).

8-bit chars are encoded straight, and wider chars are not allowed. That means this encoding is applicable if s is a binary octet string. If it is a character string then uri_encode should be used instead.

It is also slightly faster than uri_encode if s is known to contain only US-ASCII.