replace \uxxxx with &#xxxx;
Posted: Mon Nov 29, 2010 5:27 am
I've got a json feed that has unicode characters encoded with \u
I'd like to convert them to &# ;
I've tried this but get an error "Warning: preg_replace() [function.preg-replace]: Compilation failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1 in testutf8.php on line 2"
Any ideas?
I'd like to convert them to &# ;
I've tried this but get an error "Warning: preg_replace() [function.preg-replace]: Compilation failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1 in testutf8.php on line 2"
Code: Select all
$utf8str = 'Renal Dialysis Nurses \u2013 Corby';
echo preg_replace("/\u([0-9a-f]{3,4})/i","&#x\\1;",$utf8str);