Opened 11 years ago

Closed 11 years ago

#492 closed defect (worksforme)

location-specific charset not respected

Reported by: Lorenzo Raffio Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.5.x
Keywords: Cc:
uname -a:
nginx -V: 1.5.8

Description

Is it intended that

location /somelocation {

index index.htm;
charset windows-1251;

}

..isn't respected? charset outside location (in server block) works.

Change History (1)

comment:1 by Valentin V. Bartenev, 11 years ago

Resolution: worksforme
Status: newclosed

I've just tested with the configuration below:

events {}

http {
    default_type application/octet-stream;
    include conf/mime.types;

    server {
         location /index {
            index index.htm;
            charset windows-1251;
        }
    }
}

and it seems all works as expected:

% curl -I localhost:8000/index.html
HTTP/1.1 200 OK
Server: nginx/1.5.8
Date: Sat, 18 Jan 2014 16:16:21 GMT
Content-Type: text/html; charset=windows-1251
Content-Length: 612
Last-Modified: Fri, 17 Jan 2014 16:39:22 GMT
Connection: keep-alive
ETag: "52d95cba-264"
Accept-Ranges: bytes

I suspect your problem is not with the charset directive but with configuration, where requests actually are handled by another location. Please note, that every request is handled by only one location block.

You can check the documentation:

and ask further questions in mailing list: http://mailman.nginx.org/mailman/listinfo/nginx

Note: See TracTickets for help on using tickets.