php function iconv interception error solution_PHP tutorial

WBOY
Release: 2016-07-13 17:42:31
Original
1100 people have browsed it

iconv function : Requirements for converting the character encoding of a string
Syntax: string iconv ( string in_charset, string out_charset, string str)

When using this function When converting string encoding, please note that if you convert utf-8 to gb2312, the string may be truncated.

You can use the following method to solve this problem:
$str=iconv(utf-8,"gb2312//TRANSLIT",file_get_contents($filepath));
That is, when the second parameter appears Add a red part to indicate: If no character matching the source encoding is found in the target encoding, similar characters will be selected for conversion.
You can also use the //IGNORE parameter here to ignore characters that cannot be converted.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486062.htmlTechArticleiconv function: Requirements for converting the character encoding of a string Syntax: string iconv (string in_charset, string out_charset, string str ) When using this function to convert string encoding...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template