Using PHP to read the TXT file data (words, phonetic transcription and translation) to another TXT file, garbled, what is the reason?
using PHP to read the TXT file data (words, phonetic transcription and translation) to another TXT file, garbled, what is the reason? PHP
Share to:
------Solution--------------------
Of course because the coding is inconsistent.
------Solution--------------------
Reference:
How to solve it?
Quote: References:
Of course because the coding is inconsistent.
Encoding Conversion
Http://www.baidu.com/s?wd=PHP+%B1%E0%C2%EB%D7%AA%BB%BB
------Solution--------------------
Let's look at the code for a file, like UTF-8.
And look at the code for file B, like GB1312.
First $text=fget ($FPA)
Re-$text=iconv (' Utf-8 ', ' GBK ', $text)
Write to File B again
------Solution--------------------
read out what is, write out to get or what.
No coding problems, unless you have a problem with your code
You can give the test data and code
------Solution--------------------
There are both phonetic and translation, do not think, it is certainly Unicode, but, Unicode is just a name, specifically UTF-8,UTF-16,UC2 ... Or you have to judge, to keep the original txt, output txt and PHP program itself, the code of the three consistent
Read the time with "RB", write the time with "WB", the intermediate conversion format with Echo to see, if the echo results are OK, the output is no problem
------Solution--------------------
Post the code and look at it.