From 3b4875e38e8ff6dd26958d695f2e73207ab8e200 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 8 Sep 2008 17:37:44 +0000 Subject: [PATCH] [avm] always encode data in utf-8 in database. see #4254 --- src/common/logger.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/logger.py b/src/common/logger.py index 9f477ea7f..97e630e5a 100644 --- a/src/common/logger.py +++ b/src/common/logger.py @@ -723,6 +723,7 @@ class Logger: # NOTE: if there's a need to do more gzip, put that to a function try: data = GzipFile(fileobj=StringIO(str(data))).read().split('\0') + data = data.decode('utf-8') except IOError: # This data is corrupted. It probably contains non-ascii chars 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 string = StringIO() 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.close() data = string.getvalue()