I haven't been coding for a long time and I rarely have to pick up any clivs that are not UTF8 encoded. Today I had to quickly review some files and when I opened it almost immediately I wanted to do rm -rf on the folder where they were contained, some stupid individual with half a brain cell has decided to write his comments in Cyrillic. Fortunately, not the super admiral forces solve this misunderstanding of nature with 1 row in cli:
iconv -f cp1251 -t utf8 old_shitty_encoded_file -o new_good_encoded_file
I think the flags themselves speak for themselves, but let's take a quick look at them:
- -o outputfile
- -t to-encoding
- -t to-encoding
iconv has another very nice extra that can transliterate (where possible) by setting -t ASCII // TRANSLIT but unfortunately it does not work with Cyrillic 🙂