法语字符的 HTML 编码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7309183/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML Encoding for French characters
提问by LiamB
I have a email template, that has French copy. If I load this email template up in IE I receive square boxes where the accented characters are. How can I combat this? I assume it is down to encoding?
我有一个电子邮件模板,其中有法文副本。如果我在 IE 中加载这个电子邮件模板,我会收到带有重音字符的方框。我该如何应对?我认为这归结为编码?
回答by Oded
Ensure the HTML template has the correct meta tag in the header for Content-Type
.
确保 HTML 模板在 .html 的标题中具有正确的元标记Content-Type
。
You did not specify if the encoding is Latin1, UTF-8 or other - you need to find out first in order to use the right value.
您没有指定编码是 Latin1、UTF-8 还是其他 - 您需要先找出才能使用正确的值。
Here is what a UTF-8 meta tag would look like:
这是 UTF-8 元标记的样子:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
回答by bpgergo
Just make sure that the actual encoding of the textfile (I assume it'll be either ISO-8859-1 or UTF-8) is in accordance with the meta tag defining the encoding in the beginning of the file. e.g.:
只需确保文本文件的实际编码(我假设它将是 ISO-8859-1 或 UTF-8)与在文件开头定义编码的元标记一致。例如:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
see http://en.wikipedia.org/wiki/Character_encodings_in_HTML