http - 使用 : text/plain; charset ="UTF-8" 有什么缺点吗

标签 http utf-8 http-headers ascii content-type

我的网络服务器在 95% 的时间里提供的内容只是简单的 ascii。但是在极少数情况下,内容包含一些德语非 ascii 字符。

现在我可以通过检测内容是否包含任何非 ascii 字符来设置 content-type 响应 header ,或者我可以始终设置响应 header :

Content-Type: text/plain; charset=UTF-8

做后者有什么缺点吗?

最佳答案

不,它的作用只是告诉浏览器使用哪个字符集来解码您的响应。

关于http - 使用 : text/plain; charset ="UTF-8" 有什么缺点吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17934505/

相关文章:

web-services - 由于可以嗅探请求的参数,API key 是否在 http 上毫无值(value)?

http - websocket 如何知道服务器已关闭?

将 UTF-8 文本转换为 wchar_t

php - 将 UTF8 表上的 latin1 字符转换为 UTF8

java - 通过 java 将 UTF8 字符串传递到 .NET Web 服务

c# - 是否有包含 Location HTTP header 名称的标准 .NET 枚举?

http - RESTful 建议 : default value for given resource

java - 将自定义对象传递给 HttpRequestExecutingMessageHandler 时,Spring Integration 406 null

c# - FromHeader Asp.NET Core 绑定(bind)到默认值

java - 使用 sendRedirect URL 传递 header 参数