我需要将带有 unicode \xCODEs 的字符串转换为常规字符串。问题是我作为输入的字符串似乎是单引号。
有没有办法将单引号字符串转换为双引号?
这里有一些代码可以更好地理解:
$s1 = '(single quotes): Conductivity @ 20\xc3\x82\xc2\xb0C';
$s2 = "(double quotes): Conductivity @ 20\xc3\x82\xc2\xb0C";
echo "<br>";
echo iconv("UTF-8", "ISO-8859-1//IGNORE", $s1);
echo "<br>";
echo iconv("UTF-8", "ISO-8859-1//IGNORE", $s2);
将输出:
(single quotes): Conductivity @ 20\xc3\x82\xc2\xb0C
(double quotes): Conductivity @ 20°C
提前致谢!