If a website needs to be internationalized, it needs to convert the code from GB2312 to a UTF-8, there are many problems to note, if not completely converted, there will be a lot of coding problems!
If a website needs to be internationalized, it needs to convert the code from GB2312 to a UTF-8, there are many problems to note, if not completely converted, there will be a lot of coding problems!
There are five main aspects:
I. HTML page to UTF-8 encoding problem
2. PHP page to UTF-8 encoding problem
III. problem of using UTF-8 encoding in MYSQL database
4. JS-related UTF-8 coding problems
5. UTF-8 coding problems related to FLASH
I. HTML page to UTF-8 encoding problem
1. inAfter,Add a line before: </p> <meta http-equiv = 'content-type' Content = 'text/html; charset = utf-8 '/> </p> <p> The sequence cannot be incorrect. you must add the <title> label before it. otherwiseIf there are Chinese characters, the title may be garbled!
2.html file encoding:
Click the editor menu: File-> save as, you can see the encoding of the current file, make sure that the file is encoded as: UTF-8, if it is ANSI, you need to change the encoding to: UTF-8.
3. HTML file header BOM:
When converting a file from another encoding to a UTF-8 encoding, sometimes a BOM label is added at the beginning of the file, and a BOM label may cause garbled characters in the browser when displaying Chinese characters.
To delete this BOM tag:
1. you can use Dreamweaver to open the file and save it again, removing the BOM tag!
2. you can open the file with EditPlus, and in the menu "preferences"-> "files"-> "UTF-8 identifier", set to "always delete signature", and then save the file, you can remove the BOM label!
4. WEB server UTF-8 coding problems:
If you have followed the steps listed above and still encountered Chinese garbled characters, check the encoding of your WEB server.
If you are using Apache, set charset in the configuration file to UTF-8 (only the method is listed here. For the specific format, see The apache configuration file ).
If you are using Nginx, set charset in nginx. conf to utf-8. For more information, see "charset gb2312;" or change it to "charset UTF-8 ;".