Skip to content

Commit

Permalink
Gijs's use_unicode flag works as advertized. Clamp
Browse files Browse the repository at this point in the history
all string return values to be unicode by setting property on the
database connection.
  • Loading branch information
Mark Bucciarelli committed Jun 28, 2010
1 parent 4004497 commit 13c4d69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions django_monetdb/base.py
Expand Up @@ -49,6 +49,8 @@ def _cursor(self):
kwargs['database'] = settings.DATABASE_NAME
if settings.DATABASE_PASSWORD:
kwargs['password'] = settings.DATABASE_PASSWORD
# Force strings to always come back as unicode.
kwargs['use_unicode'] = True

self.connection = Database.connect(**kwargs)

Expand Down
2 changes: 1 addition & 1 deletion regress/tests.py
Expand Up @@ -263,7 +263,7 @@ def testutf8(self):
django_cafe = o.name

self.assertEqual(type(django_cafe), type(unicode_cafe))
self.assertEqual(s1.name, unicode_cafe)
self.assertEqual(django_cafe, unicode_cafe)

if __name__ == '__main__':
unittest.main()

0 comments on commit 13c4d69

Please sign in to comment.