// Fahrenheit (°F)
I have the above code commented out in my java code, but I get the "unmappable character for encoding 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 {} \;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With