File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

determine encoding of a file

 
parth jeevan
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20171
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info Paul

Will check it out.

Parth
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic