When using text in Java, depending on the system, language and api you use, there exist different names for the same encoding. See how to get to know the correct naming of your encoding of choice.
Different names in different apis
In Java there exist three different apis:
java.lang use the same naming. But the newer
java.nio uses different names for all the encodings. E.g.
utf-8 is written either
UTF8. Just have a look into Supported Encodings of the java documentation and know when to use which spelling of the encoding.