Is there any disadvantage of using: text/plain; charset=“UTF-8”

不想你离开。 提交于 2019-12-09 14:16:33

问题


My web server serves content that is in 95% of the time just simple ascii. However in some rare cases, the content contains some German non-ascii characters.

Now I could set the content-type response header by detecting if the content contains any non-ascii characters, or I could just always set the response header:

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

Is there any disadvantage in doing the latter?


回答1:


Nope, all it's there for is to tell the browser which character set to decode your response with.




回答2:


ASCII is a subset of UTF-8, so it is perfectly safe to declare the charset as utf-8 for an all-ASCII document.




回答3:


No, there is no disadvantage -- but you'll need to spell "utf-8" correctly.



来源:https://stackoverflow.com/questions/17934505/is-there-any-disadvantage-of-using-text-plain-charset-utf-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!