How to enable correct charset HTTP-header in NGINX
Solution 1:
Adding charset utf-8;
is pretty much everything you need to do. Are sure that you didn't forget to reload nginx after you changed the configuration file?
Besides at the moment of writing, curl -I http://vorb.de/ returns the following result:
HTTP/1.1 200 OK
Server: nginx/0.7.67
Date: Fri, 16 Sep 2011 13:20:03 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 1705
Last-Modified: Fri, 02 Sep 2011 15:13:17 GMT
Connection: keep-alive
Vary: Accept-Encoding
Accept-Ranges: bytes
So everything looks ok now.
Solution 2:
Setting the charset might not work if you do not set "charset_types" directive which you want UTF-8.
For example: When you set "charset utf-8;", all HTML will reflect, but not JSON files, because they are not set by default on "charset_types".
http://nginx.org/en/docs/http/ngx_http_charset_module.html#charset_types
Solution 3:
You might have to also adjust the charset_types
setting to include the mime type you want to set the charset setting for (e.g. text/calendar is not included there by default).
For what it's worth I think that text/*
should be handled by default - but you cannot use it here (as with Apache IIRC).
See http://nginx.org/en/docs/http/ngx_http_charset_module.html#charset_types
Solution 4:
charset utf-8;
source_charset utf-8;
Is what you need. It won't work for me unless I have both.