diff options
author | Kali Kaneko <kali@leap.se> | 2013-11-07 20:42:23 -0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-11-08 11:32:00 -0200 |
commit | 6c5ac99096c9eba9197a4813ce5b310b5ea3c482 (patch) | |
tree | cd5fb2bc745cb6309e67a6a80c8548276fa6b052 /client | |
parent | adfd980f831418e7d8711702cedd20ee206d2dfa (diff) |
default detected encoding to utf-8
Diffstat (limited to 'client')
-rw-r--r-- | client/changes/bug_4417_default-encoding-to-utf8 | 1 | ||||
-rw-r--r-- | client/src/leap/soledad/client/__init__.py | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/client/changes/bug_4417_default-encoding-to-utf8 b/client/changes/bug_4417_default-encoding-to-utf8 new file mode 100644 index 00000000..6801b766 --- /dev/null +++ b/client/changes/bug_4417_default-encoding-to-utf8 @@ -0,0 +1 @@ + o Defaults detected encoding to utf-8 to avoid bug if detected encoding is None. Closes: #4417 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 |