简体   繁体   English

从内容类型 header 中省略的字符集

[英]Charset omitted from content-type header

In my <head> , I have:在我的<head>中,我有:

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

Because I'm seeing a couple of funky characters, I took a closer look at the Content-Type response header in Firebug (and Safari's inspector) and both read Content-Type:text/html .因为我看到了几个时髦的字符,所以我仔细查看了 Firebug(和 Safari 的检查器)中的Content-Type响应 header 并且都读取了Content-Type:text/html No indication that the charset is recognized.没有迹象表明该字符集已被识别。 I'm using an HTML5 doctype and have also tried <meta charset="utf-8" /> .我正在使用 HTML5 文档类型并且也尝试过<meta charset="utf-8" /> Neither has worked or changed the value I see in the inspectors.两者都没有起作用或改变我在检查员中看到的价值。

I'm assuming that both developer tools would report the accurate Content-Type including the charset, but I guess I've never had a reason to look all that closely.我假设这两种开发工具都会报告准确的Content-Type包括字符集,但我想我从来没有理由仔细查看所有内容。 Is there anything else I should do to ensure that the page is rendered with the UTF8 character set?我还应该做些什么来确保页面以 UTF8 字符集呈现?

I'm not sure this is my problem, but it seemed odd so I thought I'd ask.我不确定这是我的问题,但它似乎很奇怪,所以我想我会问。 Maybe my expectations are incorrect.也许我的期望是不正确的。

Thanks.谢谢。

Although it may not have been my problem, I "corrected" the Content-Type response header to appear as expected (with the charset attached) by including the Apache directive AddDefaultCharset UTF-8 in my htaccess file.虽然这可能不是我的问题,但我通过在 myhtaccess 文件中包含 Apache 指令AddDefaultCharset UTF-8 ,“更正”了Content-Type响应 header 以按预期显示(附加字符集)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 什么是默认内容类型/字符集? - What is the default content-type/charset? 如何使用 HTML/CSS/JS 覆盖 HTTP header 中指定的 Content-Type/charset - How to override Content-Type/charset specified in HTTP header using HTML/CSS/JS 如果在内容类型标题中发送字符集,仍然建议通过元标记在头标记内发送? - If sending charset within content-type header, still advisable to send within head tag via meta tag? 如何使用 HTML 链接在请求 header 中设置“Content-Type ... charset” - How to set the “Content-Type … charset” in the request header using a HTML link 内容类型标题错误,没有多部分边界 - bad content-type header, no multipart boundary header('Content-Type: text/plain'); - header('Content-Type: text/plain'); div中的标题(“Content-Type:audio / mpeg”) - header(“Content-Type: audio/mpeg”) in div 设置Content-Type标头为多部分? - Set Content-Type header to multipart? 什么是<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” /> ? - What is <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />? <meta charset="utf-8">对比<meta http-equiv="Content-Type"> - <meta charset="utf-8"> vs <meta http-equiv="Content-Type">
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM