ant: warning: unmappable character for encoding UTF8
Solution 1
Try to change file encoding of your source files and set the Default Java File Encoding to UTF-8 also.
For Ant:
add -Dfile.encoding=UTF8
to your ANT_OPTS
environment variable
Setting the Default Java File Encoding to UTF-8:
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
Or you can start up java with an argument -Dfile.encoding=UTF8
Solution 2
The problem is not eclipse or ant. The problem is that you have a build file with special characters in it. Like smart quotes or m-dashes from MS Word. Anyway, you have characters in your XML file that are not part of the UTF-8 character set. So you should fix your XML to remove those invalid characters and replace them with similar looking but valid UTF-8 versions. Look for special characters like @ © — ® etc. and replace them with the (c) or whatever is useful to you.
BTW, the bad character is in common-targets.xml at line 83
JOHANNES_NYÅTT
Updated on February 21, 2020Comments
-
JOHANNES_NYÅTT about 4 years
I have seen numerous of questions like mine but they don't answer my question because I'm using ant and I'm not using eclipse. I run this code:
ant clean dist
and it tells me numerous times thatwarning: unmappable character for encoding UTF8
.I see on the Java command that there is a -encoding option, but that doesn't help me cuz I'm using the ant.
I'm on Linux and I'm trying to run the developer version of Sentrick; I haven't made no modifications to anything, I just downloaded it and followed all their instructions and it ain't makes no difference. I emailed the developper and they told me it was this problem but I suspect that it is actually something that gotta do with this error at the end:
BUILD FAILED /home/daniel/sentricksrc/sentrick/build.xml:22: The following error occurred while executing this line: /home/daniel/sentricksrc/sentrick/ant/common-targets.xml:83: Test de.denkselbst.sentrick.tokeniser.components.DetectedAbbreviationAnnotatorTest failed
I'm not sure what I'm gonna do now because I really need for it to work
-
McDowell over 11 yearsI suspect the problem is that some file is encoded in some other encoding but the tool chain is treating it as UTF-8.
-
JOHANNES_NYÅTT over 11 yearsI found how to kill Java with
pkill java
but how do you start it again?? -
Mugoma J. Okomba almost 8 yearsUsing
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
solved the issue for me but still don't understand why it happened. I have been usingant
for months with a problem. I use jEdit and just changed a line in one of the files and the whole code broke down!