Differences in use of UTF8 and UTF-8

Source: Internet
Author: User

Often encountered in the use of utf-8 and UTF8, now finally understand their use of the difference, and now to share with you, below we look at UTF8 and UTF-8 what is the difference.
"UTF-8" is the standard notation, PHP is not case-sensitive in English, so it can also be written as "Utf-8". "UTF-8" can also be the middle of "-" omitted, written as "UTF8". General procedures can be identified, but there are exceptions (the following article), in order to be strict, it is best to use the standard capitalization "UTF-8".

Only use "UTF8" (MySQL) in the database can only use "UTF8" in the MySQL command mode, can not use "utf-8", that is, in the PHP program can only use "Set names UTF8 (no small bars)", if you add "-" This line command will not take effect, but the header in PHP to add "-", because IE does not know the "UTF8", for reasons see below.

Header in PHP:

<?php header (' content-type:text/html; Charset=utf-8 ');?>//Strange: Content-tyep with a colon, chatset is an equal sign.
Static file use:
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>


Summary: only the alias "UTF8" of "utf-8" can be used in MySQL, but the uppercase "UTF-8" is used elsewhere.
The specific:
Use uppercase "UTF-8" outside the Command "mysql_query (set names UTF8)".

Differences in use of UTF8 and UTF-8

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.