Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

Character encoding

Thread view: 
raphbg@gmail.com - 24 Jul 2006 18:36 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.