URI::Escape incorrectly encodes spaces as "+" in its output. Test:
say uri_escape("10% is enough");
Currently outputs:
10%25+is+enough%0A
Correct output:
10%25%20is%20enough%0A
Discussion: The handling of spaces in URLs and forms is often confusing. RFC 3986 is the standard this module claims to implement, and RFC 3986 encodes spaces as "%20". The confusion arises from the application/x-www-form-urlencoded component of HTML, which says that spaces are to be encoded as plus-signs for FORM submissions. This space->plus translation applies only to the form data itself (in the body of a POST request or in the query component of a URL) and is not part of RFC 3986. In the components of the URL before the query part, including the path, spaces must be percent-encoded.
Or, put another way, "form data encoding" is not exactly the same as "uri encoding" and applies only to the query part of a URL.
URI::Escape incorrectly encodes spaces as "+" in its output. Test:
Currently outputs:
Correct output:
Discussion: The handling of spaces in URLs and forms is often confusing. RFC 3986 is the standard this module claims to implement, and RFC 3986 encodes spaces as "%20". The confusion arises from the
application/x-www-form-urlencoded
component of HTML, which says that spaces are to be encoded as plus-signs for FORM submissions. This space->plus translation applies only to the form data itself (in the body of a POST request or in the query component of a URL) and is not part of RFC 3986. In the components of the URL before the query part, including the path, spaces must be percent-encoded.Or, put another way, "form data encoding" is not exactly the same as "uri encoding" and applies only to the query part of a URL.
Pm