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

Jeroen picture Jeroen · Jul 29, 2013 · Viewed 27.1k times · Source

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?

Answer

Robadob picture Robadob · Jul 29, 2013

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