Re: Encodings supported by Java?



Well it turns out, I can test whether the characterset/encoding is supported by using the sun.io.CharacterEncoding class:

sun.io.CharacterEncoding ce = new sun.io.CharacterEncoding();
System.out.println( ce.aliasName("Cp168")); // null: doesn't exist
System.out.println( ce.aliasName("US-ASCII")); // "ASCII"
System.out.println( ce.aliasName("Cp865")); // "Cp865"

Not sure how safe/correct that is. My biggest problem still persists though. How do I encapsulate all encodings, it seems there is no way to enumerate the codepages through sun.io or any other package.

Regards,
Casper
.