How to auto detect text file encoding?

Posted by ??? on Super User See other posts from Super User or by ???
Published on 2011-06-24T08:07:02Z Indexed on 2011/06/24 8:24 UTC
Read the original article Hit count: 179

Filed under:
|
|
|

There are many plain text files which were encoded in variant charsets.

I want to convert them all to UTF-8, but before running iconv, I need to know its original encoding. Most browsers have an Auto Detect option in encodings, however, I can't check those text files one by one because there are too many.

Only having known the original encoding, I then can convert the texts by iconv -f DETECTED_CHARSET -t utf-8.

Is there any utility to detect the encoding of plain text files? It doesn't have to be a 100% perfect correct, but it should recognize most of them.

© Super User or respective owner

Related posts about linux

Related posts about batch