-1

If CSV file is encoded in ANSI, how to find out the encoding by reading the csv file in Java code. I'm working in a Java 1.6 setup.

Thanks in advance.

MWiesner
  • 8,868
  • 11
  • 36
  • 70
Umar
  • 1
  • 2
  • 2
    if it's encoded in ANSI, then its encoding *is* ANSI. – Jerry Chin Dec 23 '16 at 07:46
  • Thats true, anyway if u want to know the encoding of a file you should use third party libraries like guessencoding – AMB Dec 23 '16 at 07:48
  • You can't determine an arbitrary file's encoding. You can just use 'best guess' or third party as mentioned. If you're sure it's ANSI then you just use ANSI to decode. See [this](http://stackoverflow.com/questions/18556104/read-and-write-text-in-ansi-format]) for decoding ANSI. – Dana Dec 23 '16 at 07:48

1 Answers1

0

The encoding is not specified inside the file, it can often be guessed by trying to read the file as various encodings, but this has obvious problems.

It is a bit like guessing the language that someone is speaking, I can't distinguish between Flemish and Dutch, but I can understand a little of both because I can speak Afrikaans. The only way for me to know what language the person is speaking is to ask them.

Nameless One
  • 1,615
  • 2
  • 23
  • 39