Last Updated: February 25, 2016
·
1.783K
· 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.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside