summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Grainger <tom@yplanapp.com>2015-03-18 11:22:25 +0000
committerThomas Grainger <tom@yplanapp.com>2015-03-18 11:45:24 +0000
commit5794b777cbb4a8f951ee19ac40c7aef0e2f429a1 (patch)
treea310ac9369698a495e3629b18a7db82d076905a6
parent138293c246fbf8c6693044a89fe788d0d0446113 (diff)
downloadsqlalchemy-5794b777cbb4a8f951ee19ac40c7aef0e2f429a1.tar.gz
map MySQL encodings to python encodings fixes #2771
-rw-r--r--lib/sqlalchemy/dialects/mysql/base.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py
index b8392bd4e..7881c47a8 100644
--- a/lib/sqlalchemy/dialects/mysql/base.py
+++ b/lib/sqlalchemy/dialects/mysql/base.py
@@ -3296,9 +3296,17 @@ class _DecodingRowProxy(object):
# sets.Set(['value']) (seriously) but thankfully that doesn't
# seem to come up in DDL queries.
+ _encoding_compat = {
+ 'koi8r': 'koi8_r',
+ 'koi8u': 'koi8_u',
+ 'utf16': 'utf-16-be', # MySQL's uft16 is always bigendian
+ 'utf8mb4': 'utf8', # real utf8
+ 'eucjpms': 'ujis',
+ }
+
def __init__(self, rowproxy, charset):
self.rowproxy = rowproxy
- self.charset = charset
+ self.charset = self._encoding_compat.get(charset, charset)
def __getitem__(self, index):
item = self.rowproxy[index]