【发布时间】:2021-07-05 00:35:04
【问题描述】:
请求 http://a.com/?q=\xC3\xA2\xB0\xED
来源
$str1 = "\xC3\xA2\xB0\xED";
$str2 = '\xC3\xA2\xB0\xED';
$str3 = $_GET['q'];
echo "string1 : " . mb_detect_encoding($str1) . "<br>";
echo iconv("CP949", "UTF-8", $str1) . "<br>";
echo "string2 : " . mb_detect_encoding($str2) . "<br>";
echo iconv("CP949", "UTF-8", $str2) . "<br>";
echo "string3 : " . mb_detect_encoding($str3) . "<br>";
echo iconv("CP949", "UTF-8", $str3) . "<br>";
回复
string1 : UTF-8
창고
string2 : ASCII
\xC3\xA2\xB0\xED
string3 : ASCII
\xC3\xA2\xB0\xED
$str2, $str3 解码失败.. 我该如何解决? 以及为什么不同.. 单引号字符串 VS 双引号字符串
版本:PHP 7.1.30
提前致谢
【问题讨论】:
标签: php decoding iconv request.querystring