Encoding error when packaging a Java app


I am trying to package a Java application with ant. The build is currently failing with a lot of errors of the following form:

[javac] ... error: unmappable character (0x92) for encoding US-ASCII

I tried to change the encoding using the following techniques:

  1. I added an export LANG="en_US.UTF-8" to the configure and build phase to no avail.
  2. I added an export ANT_OPTS="-Dfile.encoding=utf-8" to the build phase.

I can see that the locale was changed (by executing locale during the build phase), but nevertheless, javac is running in US-ASCII mode.

Do you have any ideas about how I can change this behavior? I was thinking about patching the build.xml file but that sounds a little harsh.


In a project that I currently try to package setting JAVA_TOOL_OPTIONS helped to mitigate that issue. There are a lot more issues I have not yet taken care of, as I had to leave for the office :smiley:


Wow, this actually worked. Thank you! Like in your case, there are other issues, but the ASCII errors are all gone!