How do I get the server to fully support UTF-8 encoding?

Source: Internet
Author: User
You want the server to support a full UTF-8 encoded Web app, but always fall back to iso-8859-1.

Configuration is MySQL 5.6, PHP 5.5, and Apache 2.2.

Want to know exactly where to set the code? There is no need to do the configuration list or anything, but also trouble guidance.

Reply content:

You want the server to support a full UTF-8 encoded Web app, but always fall back to iso-8859-1.

Configuration is MySQL 5.6, PHP 5.5, and Apache 2.2.

Want to know exactly where to set the code? There is no need to do the configuration list or anything, but also trouble guidance.

Mysql:
The default configuration can be used without moving, and the default lantin1 encoding supports UTF-8 storage for reading. Mysqldump back up when you pay attention to skip-charset.

Php&apache:
Set the header at the beginning of the script ("Content-type:text/html;charset=utf-8")
or modify the Apache configuration (http.conf) Adddefaultcharset Utf-8

Html:
In the generated HTML page, add the

Tell the browser page to use the encoding so that the text submitted by the browser post will be utf-8.

Last but not least, you have to ensure that your page text itself is utf-8, otherwise the code is GBK, mandatory declaration into Utf-8, the browser display is garbled.

I hope I can help you:)

Mysql:set names UTF8

Php:
Header Content-type:text/html;charset=utf-8
Development coding with UTF8

Apache does not need to be configured

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.