note 95636 deleted from function.urldecode by danbrown
| From: | danbrown@php.net | Date: | Wed, 13 Jan 2010 15:50:10 +0000 |
| Subject: | note 95636 deleted from function.urldecode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164914@lists.php.net to get a copy of this message | ||
Note Submitter: Johan de Mander
----
Decoding a string generated by the JavaScript function encodeURI() with urldecode() may generate
uncorrect output if a character that is not part of the standard ASCII table is passed through
encodeURI(). Be sure to use the JavaScript function escape() instead. And vice versa ofcourse.
http://www.asciitable.com/
Note:
The character Ã
is a part of the Extended ASCII table.
<?php
echo urlencode("Ã
"); //Output: %C5
echo urldecode("%C5"); //Output: Ã
echo urldecode("%C3%85"); //Output: Ãâ¦
?>
<script language="javascript">
document.write(encodeURI("Ã
")); //Ouput: %C3%85
document.write(escape("Ã
")); //Output: %C5
</script>