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: [PHP] whats the difference in the following code?
    ... first thing that I noticed, second wondering why no charset was specified, ... some other charset not supported by htmlentities()? ... Google didn't actually want to support that character encoding. ... If you specify ISO-8859-1 in your Content-Type header, it's actually fine to omit the character encoding in htmlentities, because it uses that by default. ...
    (php.general)
  • Re: [PHP] whats the difference in the following code?
    ... me show you a line of code I noticed in a security audit just yesterday ... the character encoding when using htmlentities(), ... now about that charset ... ... but htmlentitiesdoesn't support that charset, ...
    (php.general)