Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm looking for some tool that can convert text, ideally from UTF-8 (but ISO-8859-2 and WINDOWS-1250 would be fine) into ASCII/ISO-8859-1?

I have seen some online transliteration tools but I need something for the command line (and iconv is refusing to convert the file).

share|improve this question
1  
Hm, iconv is the command line tool for that task. Mind to share how exactly it refuses to serve you? –  alex Mar 3 '11 at 18:01
add comment

2 Answers 2

up vote 6 down vote accepted

By default, iconv refuses to convert the file if it contains characters that do not exist in the target character set. Use //TRANSLIT to “downgrade” such characters.

iconv -f utf-8 -t iso8859-1//TRANSLIT
share|improve this answer
    
Oh, that's totally awesome, thx. –  Let_Me_Be Mar 3 '11 at 22:03
add comment

If you're ok to use Python, give a try to slugify which is made to do character conversion such as é => e. And forget my previous answer mentioning konwert, which is used to format conversion.

share|improve this answer
    
Hmm, the description says otherwise. Are you sure? –  Let_Me_Be Mar 3 '11 at 12:48
    
@Let_Me_Be: ok, maybe I read too quickly your question... If what you need is a not only a format conversion but a character conversion (i.e. é => e), give a try to slugify then. –  Stéphane Péchard Mar 3 '11 at 12:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.