Can nginx override encoding of Tomcat back end?

Igor Sysoev igor at sysoev.ru
Fri Nov 25 15:16:19 UTC 2011


On Fri, Nov 25, 2011 at 02:51:24PM +0000, John Moore wrote:
> I have been trying for some time now to get Tomcat to serve everything 
> with UTF-8 encoding, but some pages keep coming back with ISO-8859-1 
> encoding. As Tomcat is sitting behind an nginx remote proxy server, I 
> was wondering whether I could configure nginx to override the encoding 
> automatically? I have added 'charset utf-8' in the server block but this 
> by itself obviously doesn't do the trick. Can I set some response 
> headers, perhaps?

You can try this, but nginx will scan response body with ISO-8859-1
trying to convert it to utf-8:

http {
    charset_map  iso-8859-1 utf-8 {}

    server {
        charset           utf-8;
        override_charset  on;


-- 
Igor Sysoev



More information about the nginx mailing list