Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] configuration property for jetty to set character encoding

Yoel,

I don't think there is a system property that will set the character encoding for every single
response.  The org.eclipse.jetty.util.UrlEncoding.charset property is for setting the encoding of
url form encoded data (POST content or query strings).

You could drop in a filter that would set it for all responses.

Alternatively, I've just committed a change which will ensure that the org/eclipse/jetty/http/encoding.properties
file is consulted for default encodings of mimetypes where no encoding was specified in the content type. You
could replace the mappings in that file as you like. I hope to have a jetty-7.5.0.RC0 out by the end of the week.

cheers
Jan



On 4 August 2011 21:07, Alexei Mikhailov <alexei.mikhailov@xxxxxxxxxxxx> wrote:
On 8/2/11 5:24 PM, Yoel Spotts wrote:
Is there a way to configure jetty such that all responses of type
text/html will use a specific character encoding (like utf-8)? I realize
I can set a header with content-type = "text/html; charset=UTF-8" or I
can call response.setCharacterEncoding(“utf-8”), but I am looking for a
global configuration for every response. IIRC, Apache has
AddDefaultCharset which will cause the http header to be generated for
every page. Does jetty have such a thing?

Thanks

(BTW, I posted this to user@xxxxxxxxxxxxxxxxxx
<mailto:user@jetty.codehaus.com> as well since I’m not sure which one is
the correct place)


Afair, Jetty's default for request (and hence, I guess, also response) character encoding is UTF-8.
According to https://jira.codehaus.org/browse/JETTY-1153, you should be able to control that with a system property.

Hope that helps!
Alex-


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top