MC Emperor
MC Emperor

Reputation: 23037

How to use UTF-8 characters in a PHP-script?

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.

Upvotes: 4

Views: 2375

Answers (3)

xyz
xyz

Reputation: 1

Remove zero-width space:

$str = str_replace(chr(13), "", $str);

Upvotes: -3

Eduard7
Eduard7

Reputation: 746

You may want to try mb_ereg_replace() or iconv() with str_replace.

http://www.php.net/manual/en/function.mb-ereg-replace.php
http://hu.php.net/manual/en/function.iconv.php

Upvotes: 0

Related Questions