Home > Web Front-end > HTML Tutorial > Detailed explanation of the differences between several writing methods of UTF-8

Detailed explanation of the differences between several writing methods of UTF-8

零下一度
Release: 2017-06-30 10:09:14
Original
4383 people have browsed it

<span style="font-family: Microsoft YaHei; font-size: 14px">本质上没有区别。<br/>1.<span style="color: #ff0000">“UTF-8”</span>是标准写法;<br/>2.在Windows下边英文不区分大小写,所以也可以写成<span style="color: #ff0000">“utf-8”</span>;<br/>3.“UTF-8”也可以把中间的“-”省略,写成<span style="color: #ff0000">“UTF8”</span>。一般程序都能识别,但也有例外(如下文):<br/><br/>  为了严格一点,最好用标准的大写“UTF-8”。</span><br/><span style="font-family: Microsoft YaHei; font-size: 14px">  在MySQL数据库中只能使用“utf8”</span><br/><span style="font-family: Microsoft YaHei; font-size: 14px">  在MySQL的命令模式中只能使用<span style="color: #ff0000">“utf8”</span>,不能使用“utf-8”,也就是说在PHP程序中只能使用“set names utf8(不加小横杠)”,如果你加了“-”此行命令将不会生效,但是在PHP中header时却要加上“-”,因为IE不认识没杠的“utf8”,原因 见下文。</span><br/><span style="font-family: Microsoft YaHei; font-size: 14px">4.在IE浏览器中只能使用“utf-8”</span><br/><span style="font-family: Microsoft YaHei; font-size: 14px">  IE中如果使用了“utf8”,页面可能会 空白 或 显示为乱码。</span><br/><span style="font-family: Microsoft YaHei; font-size: 14px">  但是在其它浏览器却是正常的,原因是因为:其它浏览器默认使用的是UTF-8的编码,如果无法识别页面的编码就会用默认的UTF-8来解码,但 是IE的默认编码是GB2312,所以默认的话就。。。。。(其它浏览器指“FireFox”、“Chrome”、“Opera”)</span><br/><br/><br/><span style="font-family: Microsoft YaHei; font-size: 14px; color: #339966"><span style="color: #ff0000"><strong>总结</strong></span>  </span><br/><span style="font-family: Microsoft YaHei; font-size: 14px">  【只有在MySQL中可以使用“utf-8”的别名“utf8”,但是在其他地方一律使用大写“UTF-8”。】</span><br/><span style="font-family: Microsoft YaHei; font-size: 14px">  具体为:</span><br/><span style="font-family: Microsoft YaHei; font-size: 14px">    <span style="color: #ff0000">在命令“mysql_query(set names utf8)”外一律用大写“UTF-8”。</span></span>
Copy after login

 

The above is the detailed content of Detailed explanation of the differences between several writing methods of UTF-8. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template