Last Updated: February 25, 2016
·
1.539K
· Aeon

Dealing with cyrillic comments in your code with iconv

So you inherit some code from a russian predecessor who was coding in Windows. Predictably, the comments are in russian, and the encoding is CP-1251 (or koi-8, who knows). Here’s what you do:

mkdir conv
find . -type f -name '*.php' -exec bash -c 'iconv -f windows-1251 -t utf-8 "{}" > ./conv/"{}"' \;

then just copy the files from the new ./conv/ directory into their proper locations, run a git diff or something to make sure you didn’t mess anything up, and commit.