Encodings supported by Java?



National codepage ASCII extensions are suppose to be supported by the "java.io" and the "java.lang" packages contained in charsets.jar. Oddly enough, the "java.nio" which holds the nationalization Charset class, does not seem to know any of these specific codepages:

Charset.isSupported("Cp850"); // the outcome is false.

According to http://www.rgagnon.com/javadetails/encoding.html, a suite of language specific locales are supported (incl. Cp850). And oddly enough, I can actually use the Cp850 encoding in the "java.io" API without a problem:

....new InputStreamReader(BufferedInputStream(new FileInputStream("a.txt")), "Cp850");

It seems confusing and messy if charsets are not all encapsulated by the same object (Charset). Does this mean I have no way of testing whether a charset is supported, except through some really crude trial-n-error mis-use of an InputStream?

How should I go about encapsulating charset support for my application, if only some are contained within Charset and the rest are hidden away somewhere as string identifiers in the "java.io" package?

Regards,
Casper
.



Relevant Pages

  • Re: DBI and character sets (yet again)
    ... > - provide access to character set information, ... Does your DBD currently support NLS encodings? ... E.g., my locale's charset is UTF8, and I retrieve some UNICODE columns. ...
    (perl.dbi.users)
  • Re: XmlDocument and utf-8
    ... And the .net framework XmlDocument just always convert the charset ... suggestion value for some XML processing programs, ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to slurp/get the content of a URI?
    ... There's a special protocol for negotiating a different charset, which you won't support because your get is to primitive. ...
    (comp.lang.java.programmer)