所有重音字符应使用html实体吗? [英] Should all accented characters use html entities?

查看:141
本文介绍了所有重音字符应使用html实体吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用大量的HTML文件,大多编码为utf-8。有重音字符,因为许多是法语。我已经将它们转换为HTML实体,因为我去,但我注意到,即使在IE5.5(根据IE测试)未转换重音字符显示正确。

I am working with a large number of HTML files that are mostly encoded as utf-8. There are accented characters galore as many are in French. I have been converting them to HTML entities as I go, but I noticed that even in IE5.5 (according IE tester) the nonconverted accented characters are displaying properly.

推荐答案

如果文件是安全的,我将关心字符显示并将它们全部转换为HTML实体。 UTF-8编码,您应该将 Content-Type 标题设置为 text / html; charset = UTF-8 ,并在页面上有一个等效的元标记:

If the files are UTF-8 encoded, you should set the Content-Type header to be text/html; charset=UTF-8 and have an equivalent meta tag on the page:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

这为浏览器提供了正确显示UTF-8字符的所有信息。没有必要对重音字符进行编码。

This gives the browser all the information for displaying UTF-8 characters correctly. There is no need to encode accented characters.

这篇关于所有重音字符应使用html实体吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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