note 51630 added to function.urldecode
| From: | spam at soiland dot no | Date: | Wed, 06 Apr 2005 00:45:22 +0000 |
| Subject: | note 51630 added to function.urldecode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87549@lists.php.net to get a copy of this message | ||
About reg_var and "html reserved words"
Do not add spaces as the user suggests.
Instead, do what all HTML standards says and encode & in URLs as & in your HTML.
The reason why & works "most of the time" is that browsers are forgiving and just
decode the & as the &-sign. This breaks whenever you have a variable that matches an HTML
entity, like "gt" or "copy" or whatever. © in your URL will be
interpreted as © (the ; is not mandatory in SGML as it is "implied". In XML it
is mandatory.). The result will be the same as if you had inserted the actual character into your
source code, for instance by pressing alt-0169 and actually inserted © in your HTML.
Ie, use:
<a href="?name=stain&fish=knott">mylink</a>
Note that the decoding of & to & is done in the browser, and it's done right after
splitting the HTML into tags, attributes and content, but it works both for attributes and content.
This mean you should &entitify all &-s in any other HTML attributes as well, such as in a
form with
<input name="fish" value="fish & fries" />.
----
Manual Page -- http://www.php.net/manual/en/function.urldecode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51630
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51630&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51630&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51630&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51630&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51630&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51630&report=yes
Search -- http://master.php.net/manage/user-notes.php