[avm] always encode data in utf-8 in database. see #4254
This commit is contained in:
parent
a4bab043b9
commit
3b4875e38e
|
@ -723,6 +723,7 @@ class Logger:
|
||||||
# NOTE: if there's a need to do more gzip, put that to a function
|
# NOTE: if there's a need to do more gzip, put that to a function
|
||||||
try:
|
try:
|
||||||
data = GzipFile(fileobj=StringIO(str(data))).read().split('\0')
|
data = GzipFile(fileobj=StringIO(str(data))).read().split('\0')
|
||||||
|
data = data.decode('utf-8')
|
||||||
except IOError:
|
except IOError:
|
||||||
# This data is corrupted. It probably contains non-ascii chars
|
# This data is corrupted. It probably contains non-ascii chars
|
||||||
to_be_removed.append((hash_method, hash))
|
to_be_removed.append((hash_method, hash))
|
||||||
|
@ -763,7 +764,7 @@ class Logger:
|
||||||
# if there's a need to do more gzip, put that to a function
|
# if there's a need to do more gzip, put that to a function
|
||||||
string = StringIO()
|
string = StringIO()
|
||||||
gzip = GzipFile(fileobj=string, mode='w')
|
gzip = GzipFile(fileobj=string, mode='w')
|
||||||
data = str(data) # the gzip module can't handle unicode objects
|
data = data.encode('utf-8') # the gzip module can't handle unicode objects
|
||||||
gzip.write(data)
|
gzip.write(data)
|
||||||
gzip.close()
|
gzip.close()
|
||||||
data = string.getvalue()
|
data = string.getvalue()
|
||||||
|
|
Loading…
Reference in New Issue