"Unmappable Character for Encoding" Warning in Java

unmappable character for encoding warning in Java

Use the "\uxxxx" escape format.

According to Wikipedia, the copyright symbol is unicode U+00A9 so your line should read:

String copyright = "\u00a9 2003-2008 My Company. All rights reserved.";

Unmappable character for encoding ASCII but my files are in UTF-8

Setting the Default Java File Encoding to UTF-8:

export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8

From ant: warning: unmappable character for encoding UTF8

ant: warning: unmappable character for encoding UTF8

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

Javadoc error: unmappable character for encoding ASCII

Specifying UTF-8 as your resource encoding is a good thing to do, but you may also perform the following:

If you generate your Javadoc using javadoc binary, you may check its -encoding parameter:

javadoc: 
usage: javadoc [options] [packagenames] [sourcefiles] [@files]
...
-encoding <name> Source file encoding name

Using Eclipse, you may specify this option in field "Extra Javadoc options (...):" in last Wizard step (example: -encoding UTF-8).



Related Topics



Leave a reply



Submit