=== modified file 'django/db/backends/sqlite3/base.py'
|
|
|
26 | 26 | Database.register_converter("timestamp", util.typecast_timestamp) |
27 | 27 | Database.register_converter("TIMESTAMP", util.typecast_timestamp) |
28 | 28 | |
29 | | def utf8rowFactory(cursor, row): |
30 | | def utf8(s): |
31 | | if type(s) == unicode: |
32 | | return s.encode("utf-8") |
33 | | else: |
34 | | return s |
35 | | return [utf8(r) for r in row] |
| 29 | def utf8_cast(s): |
| 30 | return s.decode("utf-8") |
36 | 31 | |
37 | 32 | try: |
38 | 33 | # Only exists in Python 2.4+ |
… |
… |
|
59 | 54 | # Register extract and date_trunc functions. |
60 | 55 | self.connection.create_function("django_extract", 2, _sqlite_extract) |
61 | 56 | self.connection.create_function("django_date_trunc", 2, _sqlite_date_trunc) |
| 57 | self.connection.text_factory = utf8_cast |
62 | 58 | cursor = self.connection.cursor(factory=SQLiteCursorWrapper) |
63 | | cursor.row_factory = utf8rowFactory |
64 | 59 | if settings.DEBUG: |
65 | 60 | return util.CursorDebugWrapper(cursor, self) |
66 | 61 | else: |