Change History (4)

The problem occurs in management.py in syncdb where it passes raw file contents as str into cursor.execute(). Now since we have {'use_unicode': True} for mysql backend it apparently expects only unicode data.

The obvious fix would be decoding content of custom .sql files in syncdb. Here we have the same problem as with templates: we can't know for sure in which encoding the file is. Another way to do it is to connect to MySQL during syncdb with {'use_unicode': False} and without explicit charset. I think this is correct since syncdb is a command line tool and shouldn't care about unicode internals.

Summary
changed from [unicode] initial sql with non-ascii strings not imported to [unicode][patch] initial sql with non-ascii strings not imported

In the end I've decided not to load templates with codecs.open because it appears that codecs.open always opens files in binary mode while currently we use a simple open that does it in text. May be this is not an issue though...