Encoding error when packaging a Java app

Hi,

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.

Thanks!

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:

https://github.com/NobbZ/nix-dotfiles/pull/7/files#diff-68ae799d8174e63352dae33b06e3faaa28f4181e45029e9fd15a866bd3974bb4R36

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