|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-04-09 16:35 UTC] rainer-phpbugs at 7val dot com
Description: ------------ --- From manual page: http://www.php.net/function.urlencode --- urlencode() does not conform to then current w3 html5 recommendations for application/x-www-form-urlencoded data, in that '*' (0x2A) should be left as is. http://www.w3.org/TR/html5/forms.html#application/x-www-form-urlencoded-encoding-algorithm If the byte is in the range 0x2A [...] Leave the byte as is. rfc3986 would also allow '*' to be left unchangef in the query part of an URL. http://tools.ietf.org/html/rfc3986 query = *( pchar / "/" / "?" ) pchar = unreserved / pct-encoded / sub-delims / ":" / "@" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" Test script: --------------- <?php print(urlencode('*')); Expected result: ---------------- '*' should not be %-encoded, i.e. the test script above should not print %2A, but the literal '*'. Patchesphp-urlencode-asterisk-0x2a (last revision 2015-04-09 16:36 UTC by rainer-phpbugs at 7val dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 16:00:01 2025 UTC |
Sadly, rawurlencode() doesn't comply with another part of the HTML 5 recommendation: If the byte is 0x20 (U+0020 SPACE if interpreted as ASCII) Replace the byte with a single 0x2B byte ("+" (U+002B) character if interpreted as ASCII). http://3v4l.org/q8p9i print("rue: ".rawurlencode(' ')."\n"); print("ue: ".urlencode(' ')."\n"); rue: %20 ue: + I sincerely hope that no third encoding function is necessary.