views:

63

answers:

2
+1  Q: 

%u problem in PHP

Hello all,

Characters such as "š" when sent in a POST parameter and echo'd come out as %u015F - now I know this a hexidecimal value of the html unicode character - ie ş but how do I go about converting these?

I have characters sets set to UTF-8 and I've experimented with ISO character sets with no luck.

Thanks!

+1  A: 
htmlentities(urldecode($string))
Mez
A: 

I’ve never seen that a client would send %u015F instead of the UTF-8 encoded %C5%9F. But try this:

preg_replace('/%u([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', 'mb_convert_encoding("\x$1\x$2", \'UTF-8\', \'UTF-16BE\')', $str)
Gumbo