Iconv function: required syntax for character encoding for conversion string: stringiconv (stringin_charset, stringout_charset, stringstr) when using this function for character encoding conversion, note that, if UTF-8 is converted to gb2312, the string may be truncated. In this case, the iconv function: Character encoding requirements for conversion strings
Syntax: string iconv (string in_charset, string out_charset, string str)
When using this function for string encoding conversion, note that if UTF-8 is converted to gb2312, the string may be truncated.
You can solve this problem by using the following methods:
$ Str = iconv (UTF-8, "gb2312 // transcoder", file_get_contents ($ filepath ));
That is, add the red part in the second parameter to indicate that if the character matching the source encoding cannot be found in the target encoding, a similar character will be selected for conversion.
You can also use the: // IGNORE parameter to IGNORE characters that cannot be converted.
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