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

Jun 30, 2017 am 10:09 AM
quot utf-8 utf8

<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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How many bytes do utf8 encoded Chinese characters occupy? How many bytes do utf8 encoded Chinese characters occupy? Feb 21, 2023 am 11:40 AM

UTF8 encoded Chinese characters occupy 3 bytes. In UTF-8 encoding, one Chinese character is equal to three bytes, and one Chinese punctuation mark occupies three bytes; while in Unicode encoding, one Chinese character (including traditional Chinese) is equal to two bytes. UTF-8 uses 1~4 bytes to encode each character. One US-ASCIl character only needs 1 byte to encode. Latin, Greek, Cyrillic, Armenian, and Hebrew with diacritical marks. , Arabic, Syriac and other letters require 2-byte encoding.

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

What to do if node utf8 Chinese characters are garbled What to do if node utf8 Chinese characters are garbled Feb 08, 2023 am 10:29 AM

Solution to garbled Chinese characters in node utf8: 1. Check the type of "SarchName" through "typeof"; 2. Use "Name=iconv.decode(name,'gbk')" to convert the encoding to utf8.

PHP change character encoding vector in font PHP change character encoding vector in font Mar 21, 2024 pm 03:11 PM

This article will explain in detail about changing the character encoding vector in fonts in PHP. The editor thinks it is very practical, so I share it with you as a reference. I hope you can gain something after reading this article. Changing the character encoding in a string in PHP In PHP, the character encoding of a string determines how the characters are represented. To change the character encoding of a string, you can use the following steps: 1. Determine the current character encoding $encoding=mb_detect_encoding($string); This will return a string representing the current character encoding of the string, such as &quot;UTF-8&quot; or &quot;ISO-8859-1&quot;. 2. Use mb_convert_encoding

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题 不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题 Jun 13, 2016 am 10:15 AM

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。

图片消失怎么解决 图片消失怎么解决 Apr 07, 2024 pm 03:02 PM

图片消失如何解决先是图片文件上传$file=$_FILES['userfile'];  if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'

PHP returns the name of the character set PHP returns the name of the character set Mar 21, 2024 am 09:56 AM

This article will explain in detail the name of the character set returned by PHP. The editor thinks it is very practical, so I share it with you as a reference. I hope you can gain something after reading this article. 1. Character set in PHP The character set in PHP is used to represent a collection of letters, numbers and symbols used in text data. It defines how byte sequences are mapped to character values. PHP supports multiple character sets, including: ASCII: American Standard Code for Information Interchange, containing 7-bit characters and used in text-based systems. UTF-8: Universal Character Set Transformation Format - 8-bit, a variable-length character set widely used in modern systems. UTF-16: Universal Character Set Transformation Format - 16 bits, a fixed-length character set used to represent large numbers of characters

为什么小弟我在php上写的这个代码,在浏览器上什么都不显示 为什么小弟我在php上写的这个代码,在浏览器上什么都不显示 Jun 13, 2016 am 10:24 AM

为什么我在php上写的这个代码,在浏览器上什么都不显示啊

See all articles