You're asking for a program that can read a file and determine what encoding was used to write it. I don't think there is one. There was an early post on this same topic.
posted 15 years ago
Yes, this is what I was asking for. I need to be able to upload a file into an application that supports 7 languages (at this moment, in the future more). The text in the file can be written in any language. For instance, I have to following string (having diacritics) in the file "Zeitschrift f�r anorganische und allgemeine Chemie". If I read it using new BufferedReader (new InputStreamReader (in, "UTF8")) and the file is not created using UTF8 encoding I get an error. I can not tell to the customers they have to create the file using UTF-8 encoding because when opening such a file in Excel, the letters with diacritics are not displayed correctly.
If this file is created using ANSI encoding, then I can read it using
new BufferedReader (new InputStreamReader (in, "ISO8859_1")), but this won't work for other languages (like Chinese) that I need to support.
This is why I was doubting whether there is a possibility to know which encoding was used when creating a file.
But thanks anyway! Ioana
You guys haven't done this much, have ya? I suggest you study this tiny ad: