PHP修复像示例中的破碎字符

What is the best way to filter characters like this:

็็็็็็็็็็็็็็็็็็ ็็็็็็็็็

Out without breaking other foreign characters?

Thanks.

If you filter the right Unicode ranges, this should work:

$str = 'Your string with Unicode symbols'
preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $str);

https://3v4l.org/EY06F

http://php.net/manual/en/function.preg-replace.php