|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-22 11:47 UTC] lbarnaud@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 04:00:01 2025 UTC |
Description: ------------ urlencode and rawurlencode are not RFC-1738 compliant. RFC-1738 states: " Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL." Later on, the grammar is as follows: unreserved = alpha | digit | safe | extra safe = "$" | "-" | "_" | "." | "+" extra = "!" | "*" | "'" | "(" | ")" | "," However, urlencode and rawurlencode encode $!*'(), Note that, except for "$" and ",", this is also true for RFC-2396 (URI). The main problem is that Google uses another encoding scheme. When you have URLs containing these characters, your weblogs contain several different URLs for the same resource. It might also confuse some web server implementations. See: http://www.monperrus.net/martin/googenc/ Reproduce code: --------------- echo urlencode("$!*'(),"); echo rawurlencode("$!*'(),"); Expected result: ---------------- $!*'(), $!*'(), Actual result: -------------- %24%21%2A%27%28%29%2C %24%21%2A%27%28%29%2C