Encodings in Java

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.nio
  • java.io
  • java.lang

java.io and 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 UTF-8 or UTF8. Just have a look into Supported Encodings of the java documentation and know when to use which spelling of the encoding.

Sources

Supported Encodings

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.