Wednesday 17 December 2014

ant: warning: unmappable character for encoding UTF8

During Jenkins implementation I have to configure my Android application using Ant build, but I have got warning like "ant: warning: unmappable character for encoding UTF8". Which is anyway build the entire application and create the APK file, but when I run the application it displays "?" instead of "€". Then I have been searching though Google, got many answers but none of them solve my problem. Then I figured out it is the Eclipse setting I have overlooked :-).

The code snippet I am getting this issue is given below

String EURO_SYMBOL = "€";
So what happened, when I have copy pasted the  "€" sign then my Eclipse project setup for  "Text File Encoding" was "Cp1252". So "€" got converted to "Cp1252" automatically.  But default encoding for Ant was "UTF-8", so during compilation Ant try to convert all the files to "UTF-8" , which caused a junk character like "?" has been introduced.

To overcome this first I have to change my "Text File Encoding" to "UTF-8" and then I copy pasted "€" again to the line above and it solve my purpose.

Please add your comments if you still getting the warning.


No comments:

Post a Comment