开发者

running ant with 64bit Java VM leads to unmappable UTF-8 characters

开发者 https://www.devze.com 2023-01-23 21:45 出处:网络
there are some special characters in my java code like this char c = \'ä\'; (i know this is bad style and it could be avoided by using the UTF-8 code, but that\'s not the point of the question)

there are some special characters in my java code like this

 char c = 'ä';

(i know this is bad style and it could be avoided by using the UTF-8 code, but that's not the point of the question)

while this code compiles and runs fine when using java 64bit from with an ide like eclipse, when开发者_如何学Go i try to compile this via ant i get this error:

warning: unmappable character for encoding UTF8

when running ant with a 32bit java vm there is no warning.


You need to tell javac what encoding your source files are in. You can do this with the -encoding flag or encoding attribute on the javac ant task.

Frankly, just save your source as UTF-8. It's much simpler in the long run.

0

精彩评论

暂无评论...
验证码 换一张
取 消