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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-09 18:38 UTC] jimw@php.net
%u encoding is not standard.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC