This function found here, works fine for me
function jsonRemoveUnicodeSequences($struct) {
return preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", json_encode($struct));
}
Use JSON_UNESCAPED_UNICODE
inside json_encode()
if your php version >=5.4.
I resolved my problem doing this:
json_encode($array, JSON_UNESCAPED_UNICODE)
to encode the data;The result is a .json file encoded to ANSI as UTF-8.
just use this,
utf8_encode($string);
you've to replace your $arr
with $string
.
I think it will work...try this.
Source: Stackoverflow.com