Convert CP1251 to UTF8 in cli

For quite a while not to bother with codene and rarely I have to choose some izvrsenja in the cli that are not UTF8 incogniti. Today I need to quickly look at some files and as I opened it almost immediately, I was tempted to do a rm-rf a folder which contained, someone feeble-minded person with half a brain decided to write your comments in the Cyrillic alphabet. Fortunately, not super Admiralskaya forces decide this is a misunderstanding of nature 1 order in cli:

iconv -f cp1251 -t utf8 old_shitty_encoded_file -o new_good_encoded_file

I think the flags speak for themselves but let me review them fast:

  • -o outputfile
  • -t to-encoding
  • -t to-encoding

iconv has another very nice extra that can Te (where possible) as set-t ASCII//TRANSLIT but unfortunately does not work with Cyrillic 🙂

leave a reply

Your email address will not be published. Required fields are marked *

anti SPAM *