MAC Jetty encoding for UTF-8

I am running Jetty on OSX in my dev environment. Currently the character encoding seems to be flawed (probably Mac Romanian), overriding the Jetty default. How to force UTF-8 encoding? This problem seems to only appear on OSX, linux / windows works fine.

I am launching Jetty from terminal, so dedicated eclipse based solutions don't help.


source to share

3 answers

No problem, however we are starting Jetty from javaWrapper (and that shouldn't change).

The only setting I can see can affect the setting of the System.encoding System property. -Dfile.encoding=UTF-8

EDIT (our macs locale is set to utf-8)



Apparently I was wrong in blaming Jetty for this problem. The reason was maven and how maven introduces java default settings.

Setting this env variable seemed to fix the problem:

export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8


The answer is found here .



To set the default character encoding for the berth, you can set the system property "org.eclipse.jetty.util.UrlEncoding.charset" any time you like. This will affect the encoding and decoding for the URL query string or the content of the HTTP POST request.

Also, for a long time (probably early 6.1.x timeframe) it was now utf-8 by default, so I'm not sure if this is the problem you are seeing.

So, it is clear that the jetty has been an eclipse project for a few years now, so the above system settings are not an eclipse setting, it is just an artifact of our being when naming eclipse. :)




All Articles