Autodetect encoding / mojibake correction?

Hi,
Is there something to automatically detect what encoding a file is? That
way, I don't have to guess when using iconv.
Also, is there a script/gem/etc that can correct mojibake? If not, I want
to write it... though I'm not quite sure how...

Thanks,
Cameron

Hi,

ยทยทยท

On Wed, 25 Oct 2006 05:12:53 +0900, Cameron Adamez <cameron@soycow.org> wrote:

Hi,
Is there something to automatically detect what encoding a file is? That
way, I don't have to guess when using iconv.
Also, is there a script/gem/etc that can correct mojibake? If not, I want
to write it... though I'm not quite sure how...

Check our NKF and Kconv in Ruby's standard lib.

NKF.guess can be used for detecting some encodings.
There is also the Kconv lib for making some encoding conversions.

I hope that helps,

Zev