首页 > <meta charset="UTF-8"> 有什么作用

<meta charset="UTF-8"> 有什么作用

貌似html的标准规定必须使用utf-8编码。 那么这个标签还有用吗? 不写这个标签是不是没啥区别?


如果你的网页里面出现了中文,在头部没有这一句 的话,将会导致中文乱码


You should always specify the encoding used for an HTML or XML page. If you don't, you risk that characters in your content are incorrectly interpreted. This is not just an issue of human readability, increasingly machines need to understand your data too. A character encoding declaration is also needed to process non-ASCII characters entered by the user in forms, in URLs generated by scripts, and so forth.


<meta charset="utf-8"> utf-8是蒙语编码!


当你的 html 文件是以 UTF-8 编码保存的,而且里面有中文,你试试加与不加在 Chrome 的效果你就知道有没有区别了


补充:
当你没加这句的时候,网页中有中文字符,IE 浏览器不会乱码(至少我没遇到过乱码),但是 Chrome 一定会!所以最好还是写上这句~
规范一点总没错~

【热门文章】
【热门文章】