How to use UTF-8
characters in a PHP-script?
I know there is an escape character to interpret the next two characters as UTF-8
. That escape is \s
. So \xFF
works, which will represent 'ÿ
'.
But now I want to remove zero-width spaces (U+200B
) from a string. How to do that? Can I use the function str_replace()
, or maybe preg_replace()
?
Thanks in advance.
This worked for me:
$str = str_replace("\xe2\x80\x8b", '', $str);
Sources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With