PHP encoding conversion

  • 2020-05-27 04:28:58
  • OfStack


It returns 936, or the GBK encoding.

936 simplified Chinese GBK
950 traditional Chinese BIG5
437 American/Canadian English
932 Japanese
949 Korean
The 866 Russian
65001 unicode UFT-8

If the field is in Chinese and the PHP file is set to GBK2312, there will be no problem when fetching the database information:

print_r($rs[" customer code "]);

If the PHP file is set to utf-8, an error is reported.

If you want to set the encoding of php file to utf-8, you need to convert the following encoding:

print_r($rs[mb_convert_encoding(" customer code ","GBK"," UTF-8 ")); // print record array

There's no problem.

Related articles: