Home >Backend Development >PHP Tutorial >Examples of php encoding conversion methods
//I found that iconv would make an error when converting the character "—" to gb2312. Without the ignore parameter, all strings following this character cannot be saved. . No matter what, this "-" cannot be converted successfully and cannot be output. In addition, mb_convert_encoding does not have this bug. In general, use iconv. Only use the mb_convert_encoding function when you are unable to determine what the original encoding is, or when iconv cannot be displayed normally after conversion. utf-8 encoding to gbk
Format reference string iconv ( string $in_charset , string $out_charset , string $str ) string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding ] ) |