Using PHP to read the TXT file data (words, phonetic transcription and translation) to another TXT file, garbled, what is the reason?

Source: Internet
Author: User
Php

Using PHP to read the TXT file data (words, phonetic transcription and translation) to another TXT file, garbled, what is the reason?


Reply to discussion (solution)

Of course because the coding is inconsistent.

How to solve it?

Of course because the coding is inconsistent.

How to solve it?


Of course because the coding is inconsistent.

Encoding Conversion
Http://www.baidu.com/s?wd=PHP+%B1%E0%C2%EB%D7%AA%BB%BB

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

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

The code for the two files is the same. I want to separate the words, the phonetic transcription and the translation, and then write to the b.txt in a specific format. Two files are Lucida Sans Unicode, is my PHP code faulty?

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

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

Post the code and look at it.

File encoding (UTF8,ANSI) format to be consistent

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.