Edit report at http://bugs.php.net/bug.php?id=45602&edit=1
ID: 45602 Updated by: fel...@php.net Reported by: samuel at slbdata dot se Summary: urlencode/urldecode should use ASCII encoding -Status: Open +Status: Wont fix Type: Bug Package: URL related Operating System: Ubuntu 8.04.1 PHP Version: 6CVS-2008-07-23 (snap) New Comment: Old trunk related. Previous Comments: ------------------------------------------------------------------------ [2008-07-31 23:12:25] j...@php.net See also bug #45566 (you missed the hash there :) ------------------------------------------------------------------------ [2008-07-23 11:44:14] samuel at slbdata dot se Description: ------------ The "URL Generic Syntax" specification (RFC 2396) says that URLs must be US-ASCII. However, the PHP urlencode/decode functions return/accept binary data only. I think the correct behaviour would be to use Unicode (which is a superset of ASCII) for the encoded values. (This might affect some other URL-related functions, but urlencode/urldecode are the only ones that I know) See also bug 45566 . Since it's quite likely for urldecode's input to come from the $_SERVER superglobal, I think either both or none of the bugs should be fixed. Reproduce code: --------------- <?php echo urldecode("%50%48%50\n"); Expected result: ---------------- PHP Actual result: -------------- PHP Warning: urldecode() expects parameter 1 to be strictly a binary string, Unicode string given in - on line 3 Warning: urldecode() expects parameter 1 to be strictly a binary string, Unicode string given in - on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=45602&edit=1