On Tue, Jan 28, 2014 at 7:26 PM, Igor Korot <ikoro...@gmail.com> wrote: > Hi, ALL, > In here: http://stackoverflow.com/questions/21397035/set-utf8-on-mysql, > I got a suggestion to enable "use_unicode". > Problem is I'm developing on Windows and it's not that I can recompile > my python. > I'm using Python2.7 on Windows XP. > > Any pointer on how do I enable "use_unicode"?
Before you go any further: MySQL has a broken interpretation of "utf8" that allows only a subset of the full Unicode range. Instead, use "utf8mb4", which is what the rest of the world calls UTF-8. As far as I know, you can just switch in utf8mb4 everywhere that you're currently using utf8 and it'll work. According to [1] the use_unicode flag is a keyword parameter to connect(). As much as possible, I'd recommend using those parameters rather than explicitly executing SQL statements to reconfigure the connection - it's clearer, and the local client might want to reconfigure itself in response to the change too. Be aware that MySQL has a number of issues with Unicode and sorting (or at least, it did the last time I checked, which was a while ago now), not to mention other problems with its default MyISAM format. You may want to consider PostgreSQL instead. ChrisA [1] http://mysql-python.sourceforge.net/MySQLdb.html -- https://mail.python.org/mailman/listinfo/python-list