I have values like
Stra\u00c3\u009fe
and
Aur\u00e9lien
I need them transcoded to say Straße or example 2: Aurélien. How can I archive this using PHP functions? The data origins from php_ldap and an Active Directory source if that helps.
I have values like
Stra\u00c3\u009fe
and
Aur\u00e9lien
I need them transcoded to say Straße or example 2: Aurélien. How can I archive this using PHP functions? The data origins from php_ldap and an Active Directory source if that helps.
You need to convert it from Unicode to UTF-8 using multi-byte conversion. A simple example would be
#source: http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-char
function replace_unicode_escape_sequence($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
function unicode_decode($str) {
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str);
}
$str = unicode_decode('\u00e9');