The above picture is from Bing。
When translating '微博' into Korean using Microsoft, the interface returns a garbled character '웨이보(微��' because it is unknown if there are other translation results that are garbled.May I ask if there is any code that can automatically filter out garbled characters and store them in the database.
How to filter out garbled text and only leave '웨이보(微'?
The following code cannot remove garbled characters:
$text = "웨이보(微��";$output = mb_comvert_encoding ($text, 'utf-8', 'utf-8'); // output 웨이보(微��$output = iconv ('UTF-8 ','UTF-8/IGNORE', $text); // output 웨이보(微��$isRight = mb_check_decoding ($text);//it returned true.$array = preg_split ('//u', $text);var_dump($text);array(9) { [0]=> string(0) "" [1]=> string(3) "웨" [2]=> string(3) "이" [3]=> string(3) "보" [4]=> string(1) "(" [5]=> string(3) "微" [6]=> string(3) "�" [7]=> string(3) "�" [8]=> string(0) ""}
How can I do?