note 50079 added to function.urlencode

From: Date: Thu, 17 Feb 2005 11:49:44 +0000
Subject: note 50079 added to function.urlencode
Groups: php.notes 
Request: Send a blank email to php-notes+get-85158@lists.php.net to get a copy of this message
The information on this page is misleading in that you might think the ampersand (&) will only need to be escaped as &amp; when there is ambiguity with an existing character entity. This is false; the W3C page linked to from here clarifies that the ampersands must ALWAYS be escaped. The following: <a href='/script.php?variable1=value1&variable2=value2'>Link</a> is INVALID HTML. It needs to be written as: <a href='/script.php?variable1=value1&amp;variable2=value2'>Link</a> in order for the link to go to: /script.php?variable1=value1&variable2=value2 I applaud the W3C's recommendation to use semicolons (';') instead of the ampersands, but it doesn't really change the fact that you still need to HTML-escape the value of all your HTML tag attributes. The following: <span title='Rose & Mary'>Some text</span> is also INVALID HTML. It needs to be escaped as: <span title='Rose &amp; Mary'>Some text</span> ---- Manual Page -- http://www.php.net/manual/en/function.urlencode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50079 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50079&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50079&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50079&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50079&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50079&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50079&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85158) next »