Bug #15027: Unicode chars (query string decoding)
| From: | nataniel at implix dot com | Date: | Mon, 14 Jan 2002 10:57:26 +0000 |
| Subject: | Bug #15027: Unicode chars (query string decoding) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-76996@lists.php.net to get a copy of this message | ||
From: nataniel@implix.com
Operating system: All
PHP version: 4.1.1
PHP Bug Type: *Languages/Translation
Bug description: Unicode chars (query string decoding)
urldecode() function is not supporting UNICODE characters coding, like
%u0627 for the Arabic letter ALEF (ا in HTML). So when you are
passing the Unicode chars through GET/POST or urldecode(), you will get
only encoded string:
http://server.com/test.php?test=%u062D%u0645%u0627%u062F%u0629
in test.php:
print('test = '.$test);
you will get:
test = %u062D%u0645%u0627%u062F%u0629
What you have to do is to "manually" convert it to html entitles:
------------------------------------------------------------
function unicode_decode($txt) {
return ereg_replace('%u0([[:alnum:]]{3})', '&#x\1;',$txt);
}
------------------------------------------------------------
--
Edit bug report at: http://bugs.php.net/?id=15027&edit=1