mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 12:27:03 +08:00
Unicode support.
This commit is contained in:
@ -41,6 +41,10 @@ def Thing2Str(s, d):
|
|||||||
"""Convert something into a string via str()."""
|
"""Convert something into a string via str()."""
|
||||||
return str(s)
|
return str(s)
|
||||||
|
|
||||||
|
def Unicode2Str(s, d):
|
||||||
|
"""Convert a unicode object to a string using latin1 encoding."""
|
||||||
|
return s.encode('latin')
|
||||||
|
|
||||||
# Python 1.5.2 compatibility hack
|
# Python 1.5.2 compatibility hack
|
||||||
if str(0L)[-1]=='L':
|
if str(0L)[-1]=='L':
|
||||||
def Long2Int(l, d):
|
def Long2Int(l, d):
|
||||||
@ -106,3 +110,6 @@ conversions = {
|
|||||||
FIELD_TYPE.DATE: Date_or_None,
|
FIELD_TYPE.DATE: Date_or_None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hasattr(types, 'UnicodeType'):
|
||||||
|
conversions[types.UnicodeType] = Unicode2Str
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user