aspose file tools*
The moose likes Java in General and the fly likes determine encoding of a  file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "determine encoding of a  file" Watch "determine encoding of a  file" New topic
Author

determine encoding of a file

parth jeevan
Greenhorn

Joined: Jun 19, 2006
Posts: 17
Hello All

I hope this question belongs here in the intermediate Java forum.I apologise if it doesnt.
I wanted to know if there is a way to find out the encoding(UTF-8 or ISO-8859-1 or some other) of a text file.If there's a way to determine the encoding by looking at the hex format of the text?

Ive googled this but found many ambiguous answers.

Thanks
Parth
parth jeevan
Greenhorn

Joined: Jun 19, 2006
Posts: 17
Hi
Just wanted to add that the reason i need this is these files are beeing sent to us by an external system and unfortunately they dont know what encoding they'r using.



Parth
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

You can't always tell reliably, but people have written code that tries. I have heard that Jchardet does a pretty good job.
parth jeevan
Greenhorn

Joined: Jun 19, 2006
Posts: 17
Thanks for the info Paul

Will check it out.

Parth
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: determine encoding of a file
 
Similar Threads
International Characters
Java Mail working but putting in some junk characters
difference between ASCII and binary files
How to determine the encoding of an XML string?
How to determine Text File Encoding