compilation error regarding unmappable character for encoding UTF-8
// Fahrenheit (°F)
I have the above code commented out in my java code, but I get the "unmappable character for e开发者_开发技巧ncoding UTF-8". How do I fix this?
You need to specify the encoding in your javac command line using the -encoding flag
javac -encoding UTF-8 myclass.java
You can also look into making UTF-8 your system default encoding so you don't have to specify it.
Having this same compiler error with a ton of java files in the ISO-8859-1. Opening one by one is impracticable. So, here's a quick fix (using recode):
find -name '*.java' -exec recode Latin-1..UTF-8 {} \;
精彩评论