Ok. As @Jonathan Leffler already said, if you can specify the unicode character ranges for the characters that need to be replaced, you can use a regular expression to replace the characters with an empty string.
A unicode character is specified as \x{FFFF}
in an expression (in PHP). In addition, you have to set the u
modifier to make PHP treat the pattern as UTF8.
So in the end, you have something like this:
preg_replace('/[\x{FFFF}-\x{FFFF}]+/u','',$string);
where
/.../u
are the delimiters plus the modifier
[...]+
is a character class plus quantifier, which means match any of these characters inside one or mor times
\x{FFFF}-\x{FFFF}
is a unicode character range (obviously you have to provide the right codepoints/numbers of the characters).
You can also negate the group with a ^
you can specify the range which you want to keep:
preg_replace('/[^\x{FFFF}-\x{FFFF}]+/u','',$string);
More information: