本文介绍了使用是否有任何缺点:text / plain;字符集=" UTF-8英寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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?

推荐答案

不,它的全部内容是告诉浏览器哪个字符集可以解码您的回复。

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

这篇关于使用是否有任何缺点:text / plain;字符集=" UTF-8英寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 06:16