reyk / httpd

OpenBSD httpd
Other
313 stars 31 forks source link

charsets #5

Open reyk opened 9 years ago

reyk commented 9 years ago

Support configurable charset for directory auto index and files.

larryhynes commented 9 years ago

Has there been any progress made on this? I've experimented with various header append recipes and nothing, so far, has worked. I want to declare utf-8 encoding for text/* types.

mxlbzn commented 8 years ago

impossibility to specify charset for text files is rather a bug, i think..

mxlbzn commented 7 years ago

I guess the implementation should be fairly straightforward, as it is just about declaration of the document charset (which is not essential for text/html documents since it can be done by the meta charset tag in the document itself, but that is not the case for e.g. text/plain documents), and not doing any charset conversion.. obviously, even top web servers ignore the Accept-Charset header:

$ curl -vLH 'Accept-Charset: ISO-8859-1' 'https://www.google.com/' 2>&1 | grep -i charset                           
> Accept-Charset: ISO-8859-1                                                                                                  
< Content-Type: text/html; charset=UTF-8                                                                                      
> Accept-Charset: ISO-8859-1                                                                                                  
< Content-Type: text/html; charset=ISO-8859-2                                                                                 
Binary file (standard input) matches
milkey-mouse commented 7 years ago

@larryhynes FWIW here's my simple patch to specify charset=utf-8 on text MIME types. I'm working on a better one (configurable, etc) that I'll submit to the mailing list.

xse commented 4 months ago

the following works:

types {
        include "/usr/share/misc/mime.types"
        "text"/"plain; charset=utf-8" txt "log"
}

I spent way too much time figuring out that log had to be quoted because it's a valid configuration option.