From 3b2763b738939c605c3d4480501fde4463c0f2eb Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 7 Nov 2013 20:42:23 -0200 Subject: default detected encoding to utf-8 --- client/src/leap/soledad/client/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'client/src') diff --git a/client/src/leap/soledad/client/__init__.py b/client/src/leap/soledad/client/__init__.py index 534040ef..a159d773 100644 --- a/client/src/leap/soledad/client/__init__.py +++ b/client/src/leap/soledad/client/__init__.py @@ -847,8 +847,9 @@ class Soledad(object): elif isinstance(content, str): try: result = chardet.detect(content) - content = content.decode(result["encoding"]).encode("utf-8")\ - .decode("utf-8") + default = "utf-8" + encoding = result["encoding"] or default + content = content.decode(encoding) except UnicodeError: pass return content -- cgit v1.2.3