From 13c4d694cd940b34728ec84787f400d2793679eb Mon Sep 17 00:00:00 2001 From: Mark Bucciarelli Date: Mon, 28 Jun 2010 14:56:49 -0400 Subject: [PATCH] Gijs's use_unicode flag works as advertized. Clamp all string return values to be unicode by setting property on the database connection. --- django_monetdb/base.py | 2 ++ regress/tests.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/django_monetdb/base.py b/django_monetdb/base.py index 26ccc03..f5bdb45 100644 --- a/django_monetdb/base.py +++ b/django_monetdb/base.py @@ -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) diff --git a/regress/tests.py b/regress/tests.py index 24f813b..23ba843 100644 --- a/regress/tests.py +++ b/regress/tests.py @@ -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()