The function of this paper is to avoid the garbled problem caused by the use of UTF-8 encoding, which does not contain the specific garbled solution and the content of the code conversion. For an in-depth understanding of UTF-8 encoding, see: "PHP matches regular expressions for UTF-8 Chinese characters"
1, Editor: Do not use any Microsoft editor, what Frontpage,web Designer, Notepad, WordPad and so on, can be lost all lost, because these editors will be in your UTF-8 document before the BOM, the specific description of the BOM, you can find here, When I went directly to the notebook to UTF-8 cover the original file, resulting in a large number of code damage, still fresh memory.
2, MySQL database: Pay attention to build a library, build a table, build a field (note there are three), you have to choose Utf8_general_ci finishing Format (collation), in PHP using mysql_connect () function to connect the data, you need to add a sentence:
mysql_query (' Set names "UTF8");
3, PHP:
Use the Mbstring library, and do not use the Iconv library.
Use Preg instead of using Ereg to handle characters.
With the Htmlentities () function, the Html_entity_decode () function takes a third argument:
CODE:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.