Is there a function in PHP that can decode Unicode escape sequences like "\u00ed
" to "í
" and all other similar occurrences?
I found similar question here but is doesn't seem to work.
Is there a function in PHP that can decode Unicode escape sequences like "\u00ed
" to "í
" and all other similar occurrences?
I found similar question here but is doesn't seem to work.
Try this:
function replace_unicode_escape_sequence($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UTF-16BE');
}
$str = preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str);