File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Original file line number Diff line number Diff line change 47
47
NotSupportedError , ProgrammingError
48
48
49
49
50
+ def normalize_utf8mb4 (charset ):
51
+ return 'utf8' if charset == 'utf8mb4' else charset
52
+
50
53
class BaseCursor (object ):
51
54
52
55
"""A base for Cursor classes. Useful attributes:
@@ -177,7 +180,7 @@ def execute(self, query, args=None):
177
180
"""
178
181
del self .messages [:]
179
182
db = self ._get_db ()
180
- charset = db .character_set_name ()
183
+ charset = normalize_utf8mb4 ( db .character_set_name () )
181
184
if isinstance (query , unicode ):
182
185
query = query .encode (charset )
183
186
if args is not None :
@@ -225,7 +228,7 @@ def executemany(self, query, args):
225
228
del self .messages [:]
226
229
db = self ._get_db ()
227
230
if not args : return
228
- charset = db .character_set_name ()
231
+ charset = normalize_utf8mb4 ( db .character_set_name () )
229
232
if isinstance (query , unicode ): query = query .encode (charset )
230
233
m = insert_values .search (query )
231
234
if not m :
You can’t perform that action at this time.
0 commit comments