[buug] recode vs. iconv

Ian Zimmerman itz at buug.org
Tue Dec 11 16:12:25 PST 2012

Today I needed to convert some text files from latin1 to plain ascii,
preferably with transcriptions (e.g. ß into ss, ä into ae, and so on).
They were large enough that doing it manually was out of the question,
even in an excellent editor like emacs ;-)  I remembered that recode and
iconv were the two programs potentially suitable for the task.

I tried recode first, but it was a disaster, I couldn't make it work
despite reading the full fine manual (info version) in detail.  It would
simply error out on any non-ascii character unless I gave the --force
option (even when I called it not in-place but as a filter), and then it
would succeed but silently drop some of them without substituting

On the other hand, iconv worked the first time, when I gave it the
//TRANSLIT option, but it didn't really transcribe my preferred way,
instead it just substituted a single character for each non-ascii one
(ß into s, ä into a, ...).

This must be a common need and surely I'm missing the right way to do it?

Ian Zimmerman
gpg public key: 1024D/C6FF61AD
fingerprint: 66DC D68F 5C1B 4D71 2EE5  BD03 8A00 786C C6FF 61AD
Rule 420: All persons more than eight miles high to leave the court.

More information about the buug mailing list