Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
%PHP中的u问题_Php_Character Encoding - Fatal编程技术网

%PHP中的u问题

%PHP中的u问题,php,character-encoding,Php,Character Encoding,像“š”这样的字符在POST参数中发送时会显示为%u015F-现在我知道这是html unicode字符的十六进制值-即ş;但是我如何转换这些呢 我已经将字符集设置为UTF-8,并且我已经尝试过ISO字符集,但运气不好 谢谢 我从未见过客户端会发送%u015F而不是UTF-8编码的%C5%9F。但是试试这个: htmlentities(urldecode($string)) preg_replace('/%u([0-9a-fA-F]{2})([0-9a-fA-F]{2})/e', 'm

像“š”这样的字符在POST参数中发送时会显示为
%u015F
-现在我知道这是html unicode字符的十六进制值-即
ş
;但是我如何转换这些呢

我已经将字符集设置为UTF-8,并且我已经尝试过ISO字符集,但运气不好


谢谢

我从未见过客户端会发送
%u015F
而不是UTF-8编码的
%C5%9F
。但是试试这个:

htmlentities(urldecode($string))
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)

我从未见过客户端会发送
%u015F
而不是UTF-8编码的
%C5%9F
。但是试试这个:

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)

为了清楚起见,我希望输出为;-上面的问题已转换为şcharacter,只是为了明确我希望输出为&ş3;-上述问题被转换为ş字符