Fixed connection to mysql to use UTF8 encoding.

Fixes: https://launchpad.net/bugs/941692
This commit is contained in:
Rastislav Pecik 2012-02-27 01:42:35 +01:00
parent 9dadcb9217
commit b56d8d2a06

View File

@ -193,6 +193,12 @@ class Manager(object):
else: else:
self.db_url = u'sqlite:///%s/%s.sqlite' % ( self.db_url = u'sqlite:///%s/%s.sqlite' % (
AppLocation.get_section_data_path(plugin_name), plugin_name) AppLocation.get_section_data_path(plugin_name), plugin_name)
elif db_type == u'mysql' :
self.db_url = u'%s://%s:%s@%s/%s?charset=utf8' % (db_type,
urlquote(unicode(settings.value(u'db username').toString())),
urlquote(unicode(settings.value(u'db password').toString())),
urlquote(unicode(settings.value(u'db hostname').toString())),
urlquote(unicode(settings.value(u'db database').toString())))
else: else:
self.db_url = u'%s://%s:%s@%s/%s' % (db_type, self.db_url = u'%s://%s:%s@%s/%s' % (db_type,
urlquote(unicode(settings.value(u'db username').toString())), urlquote(unicode(settings.value(u'db username').toString())),