HTML元字符集的工作原理 [英] How HTML meta charset works

查看:92
本文介绍了HTML元字符集的工作原理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

元字元集如何运作?如果我错了,请纠正我的理解。根据我的理解,字符集用于指示该页面将被显示什么编码?如果我把一个非常具体的编码,其他人可能无法看到它正确显示。但为什么?不是在元标记上设置的编码,浏览器是否基于字符集渲染字符?

How does meta charset work? Please correct my understanding if I am wrong. As I understand it, the charset is used as to indicate what encoding the page is to be shown? If I put a very specific encoding, others might not be able to see it displayed correctly. But why? Isn't the encoding set on the meta tage and the browser renders characters based on the charset? Or do I have the wrong idea (probably)?

推荐答案

字母,数字和其他字符在计算机中必须以字节表示。

Letters, numbers and other characters have to represented in computers as bytes.

有不同的方法(字符编码)可以用来表示相同的字符。通常你会想要使用UTF-8这些天。

There are different ways (character encodings) that can be used to represent the same characters. Usually you'll want to use UTF-8 these days.

Meta字符集告诉浏览器你已经使用,所以它知道如何解码的字节正确的字符。

Meta charset tells the browser which one you have used so it knows how to decode the bytes into characters correctly.

如果你在使用ISO-8859-1时告诉浏览器你正在使用UTF-8,那么你会看到错误的字符在编码不重叠的地方。

If you tell the browser you are using UTF-8 when you are actually using ISO-8859-1, then you'll get errors (the wrong characters) showing up in places where the encodings do not overlap.

这篇关于HTML元字符集的工作原理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆