简体   繁体   中英

Having trouble removing unicode chars from string

I am trying to remove a unicode char but nothing works for me at the moment. The value's come from an Excelsheet that I'm reading. It's the first unicode char from the last value in the array I'm trying to remove. But still haven't got it to work any help would be great.

The value's:

["\u00d81-39","\u00d840-110","\u009d\u00d8111-160"]

I tried:

$value = str_replace(chr(157),"",$value);
$value = str_replace("\u009d","",$value);
$value = preg_replace('/\\\\u[0-9A-F]{4}/i','',$value);
$value = preg_replace('/\\\\u[009d]{4}/i','',$value);

You should look at the answers on Unicode character in PHP string

Try this:

$value = json_decode('"'.$value.'"');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM