utf 8 - remove utf-8 figure spaces with php -


i have xml files figure spaces in it, need remove php. utf-8 code these e2 80 a9. if i'm not mistaken php not seem 6 byte utf-8 chars, far @ least i'm unable find way delete figure spaces functions preg_replace.

anybody tips or better solution problem?

have tried preg_replace('/\x{2007}/u', '', $stringwithfigurespaces);?

u+2007 unicode codepoint figure space.

please see my answer on similar unicode-regex topic php includes information \x{ffff}-syntax.

regarding comment non-working - following works on machine:

$ php -a interactive shell  php > $str = "a\xe2\x80\x87b";  // \xe2\x80\x87 figure space php > echo preg_replace('/\x{2007}/u', '_', $str); // \x{2007} pcre unicode codepoint notation u+2007 codepoint a_b 

what's php version? sure character figure space @ all? can run following snippet on string?

for ($i = 0; $i < strlen($str); $i++) {     printf('%x ', ord($str[$i])); } 

on test string outputs

61 e2 80 87 62  |u+2007|  b 

edit after op comment:

\xe2\x80\xa9 paragraph separator unicode codepoint u+2029, code should preg_replace('/\x{2029}/u', '', $stringwithuglycharacter);


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -