MySQL charset hell
There are not a lot of paradises on this corner of the earth, but there's one sure hell: charsets with MySQL. MySQL has the peculiar idea of defaulting everything to latin1. Everything.
Everything should be utf-8 of course, just because it fucking works with every character on earth. And no, MySQL's utf8 cannot. Because they rushed it in I suppose. So if you want to be able to use every character on earth, you should use utf8mb4.
Now, let's assume you got the following error message somewhere in some obscure logs:
The road to heaven
First, you will need to edit your my.cnf file, to be found on linux in /etc/mysql/ and add/modify the following properties in the proper section:Now what?
Now, you're still in hell, but you just got the promise of not getting deeper. And you still need to get out, that is to change all your tables to store UTF-8. There you have several options, some consisting in dumping everything, recreating a new DB and reloading everything (see the second link below). I chose the path of the ALTER. Here is what you can do:Migrate your dbs:
Locate the faulty tables:
Migrate table after table:
This is the easiest solution by far and it will convert all char based columns. If for any reason you want to convert only a few columns, you will have to alter them by hand:
And remember: For every MySQL install you do from that point on, do this first. Less trouble for after.
Thanks:
Dos and Don'ts
Never dolz-string: We'll try to make it faster
I've setup a small page where I share my findings in trying to optimize the implementation of lz-string. This work will continue in the coming weeks. You can leave a comment in this blog entry for any feedback.
Just released: lz-string
All can be read on the home page: https://pieroxy.net/blog/pages/lz-string/index.html And a demo can be found below for live compression: https://pieroxy.net/blog/pages/lz-string/demo.html