In 2012 I was neck deep in character encoding. What I was finding out was that our MySQL had been setup wrong. And what took me a bit to find out was that MySQL character encoding was hell.
If it weren’t for BlueBox’s Getting out of MySQL Character Set Hell blog post, I think I would’ve been sunk. This was some nasty stuff.
I ended up automating the steps to get me to mostly done. I figured I’d end up sharing this code as it could be useful for others. Your mileage may vary.