I am using php in order to read a .txt file which contains any kind of characters. When I use the php function, utf8_decode() characters such as éàêô... are correctly recognized but chinese characters are displayed as ????. And when I don't use utf8_decode() the echo output of a chinese character is something like 北京å. What is stranged is that on the source code of the generated webpage the chinese characters are corectly displayed.
How can I do to have a correct output ?
I use the fgets function to creat a variable $buffer to read into the .txt file and then :
$buffer = explode(" ", $buffer);
foreach($buffer as $word){
//$word=utf8_decode($word);
echo "$word \n";
}
Thank you very much
看看mb_string的不同的功能- http://php.net/mb_string
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.