note 48154 deleted from function.urlencode by tularis
| From: | tularis@php.net | Date: | Sun, 19 Dec 2004 09:38:36 +0000 |
| Subject: | note 48154 deleted from function.urlencode by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82015@lists.php.net to get a copy of this message | ||
Note Submitter: elqabbany-at-yahoo-dot-com
----
It appears that the example above that wraps urlencode() in a call to htmlentities() is just plain
meaningless. The urlencode() function returns a string that only contains the following characters:
alphanumeric
_ (underscore)
- (minus)
. (period)
% (percent)
None of the above characters requires any special html encoding. Thus, wrapping the result of
urlencode() in htmlentities() is confusing and gives no benefit.
Here's the proof:
<?
$str = "abcdefghijklmnopqrstuvwxyzABCDEFHIJKLMNOPQRSTUVWXYZ0123456789_-.%";
$enc = htmlentities($str);
if ($str === $enc) echo "no difference\n";
else echo "they differ\n";
?>
/mme/