php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15027 Unicode chars (query string decoding)
Submitted: 2002-01-14 05:57 UTC Modified: 2002-04-09 18:38 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: nataniel at implix dot com Assigned:
Status: Not a bug Package: *Languages/Translation
PHP Version: 4.1.1 OS: All
Private report: No CVE-ID: None
 [2002-01-14 05:57 UTC] nataniel at implix dot com
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);
}
------------------------------------------------------------

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-09 18:38 UTC] jimw@php.net
%u encoding is not standard.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Nov 19 13:01:26 2018 UTC