The solution on the net said after crawling with Iconv () transcoding. Look after I feel that something is wrong: one is not necessarily compiled Iconv library, the bigger problem is that the encoding is the same as the time of the stream conversion (if the use of iconv actually PHP two times code: Flow, UTF-8, GB2312): This is not the white busy it?
Carefully read the PHP document (do not know how people write code, in fact the document is very clear AH), above about fopen () and file_get_contents () mentioned "default is UTF-8, but users can use Stream_default_ Encoding () or user-defined context attribute change encoding "(If Unicode semantics is enabled, the default encoding of the read data is UTF-8. You can specify a different encoding by creating a custom context or by changing the default using Stream_default_encoding ().)。 So with stream_default_encoding (' gb2312′); test: But faint, this function does not exist?! It seems that PHP 6 is not supported. But despair, there are "user-defined context properties" that you can use.
After a closer look at the document, the problem was solved:
Copy the Code code as follows:
Sets the encoding format of the stream, which is the file stream, which, if it is network access, changes to HTTP
$opts = Array (' file ' = = Array (' encoding ' = ' gb2312 '));
$ctxt = Stream_context_create ($opts);
file_get_contents (filename, file_text, $ctxt);
The above describes the world of Warcraft can not read the required files PHP read file garbled problem, including the World of Warcraft can not read the required files in terms of content, I hope that the PHP tutorial interested in a friend helpful.