Hi,
I'm having some problems here with character encoding. I need to read
a file that I have no idea which character encoding it is using. Is
there a way to discover which encoding the file is using and convert it
to the character encoding that I want?
Thanks...
Raphael
cp - 24 Jul 2006 23:06 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> Raphael
Dont know if this is what you need....
String defaultEncoding = Charset.defaultCharset().name()
Returns the canonical name of the encodingtype used in this JVM instance.
Another suggestion:
String defaultEncoding = new InputStreamReader(InputStream
in).getEncoding();
Rogan Dawes - 25 Jul 2006 06:38 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> Raphael
You can try the Mozilla JCharDet library, which takes a statistical
approach to identifying the character set based on presences of certain
types of character.
Once you have identified the charset, then you can re-read the byte
stream using a suitable InputStreamReader, or whatever.
Rogan