问题
I need to convert string with unicode \xCODEs into regular string. The issue is that string which I have as input seems to be single-quoted.
Is there any way to convert single-quoted string into double?
Here's some code for better understanding:
$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);
will output:
(single quotes): Conductivity @ 20\xc3\x82\xc2\xb0C
(double quotes): Conductivity @ 20°C
Thanks in advance!
回答1:
It turns that I was looking for stripcslashes
Many thanks @mario!
来源:https://stackoverflow.com/questions/37444753/php-convert-single-quoted-string-into-double-quoted