chrome如何建立正确的字符编码? [英] How does chrome establish the right character-encoding?

查看:202
本文介绍了chrome如何建立正确的字符编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直使用很多字符集,我发现了很多问题,当试图建立适当的字符集随机网页。
字符集可以在html文档的头部或< head> 部分中多次设置,有时省略声明。尽管存在这些问题,chrome在每次设置最佳字符集时都是一个很好的工作。


我试过搜索来源,但没有设法找到任何东西,因为我不知道在哪里看。


所以我的问题是哪里可以找到算法?

I've been working with a lot of charsets lately and I discovered a lot of issues when trying to establish the proper charset for a random web page. The charset can be set in the headers of the html document, or inside the <head> section, multiple times or sometimes the declaration is omitted. Despite these issues chrome dose a great job at setting the best charset every time.

I've tried searching the sources but didn't manage to find anything as I don't know where to look.

So my question is where could I find the algorithm?

感谢

有问题示例:

0047
文档的HTTP标题基于服务器配置):

Content-type:text / html; charset = utf-8

,文件格式如下:

problematic example:

HTTP header of a document (based on server configurations):
Content-type: text/html; charset=utf-8
and the document looks like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-type" content="text/html;charset=ISO-8859-1" />
</head>
<body>...</body>
</html>

要使用哪种编码来渲染文本?

Which encoding would be used to render the text?

推荐答案

标题字符集将始终覆盖元字符集。

Headers charset will always overrule meta charset.

这篇关于chrome如何建立正确的字符编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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