For string body make sure we serialize unicode properly

This commit is contained in:
Honza Král
2013-12-04 13:22:33 +01:00
parent 19f9eaab95
commit 4420296636
+4
View File
@@ -21,6 +21,10 @@ class JSONSerializer(object):
def dumps(self, data):
# don't serialize strings
if isinstance(data, (type(''), type(u''))):
try:
return data.encode('utf-8')
except UnicodeDecodeError:
# Python 2 and str, no need to re-encode
return data
try: