


Detailed explanation of the differences between several writing methods of UTF-8
<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>
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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

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.

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 "UTF-8" or "ISO-8859-1". 2. Use mb_convert_encoding

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

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

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
