Home > Article > Backend Development > PHP character encoding conversion problem mb_convert_encoding and iconv function
gb2312 to big5 encoding conversion:
If you use the above function, you need to install it but you need to enable the mbstring extension library first. string mb_convert_encoding (string str, string to_encoding [, mixed from_encoding]) You need to enable the mbstring extension library first. In php.ini, add; extension=php_mbstring.dll in front of; to remove mb_convert_encoding. You can specify multiple input encodings, which will be based on the content. Automatic recognition, but the execution efficiency is much worse than iconv; string iconv (string in_charset, string out_charset, string str) Note: In addition to specifying the encoding to be converted to, the second parameter can also add two suffixes: //translit and //ignore, where //translit will automatically convert characters that cannot be directly converted into one or more Approximate characters, //ignore will ignore characters that cannot be converted, and the default effect is to truncate from the first illegal character. 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.
|