From 02286fde53ceca4ede0cdc3d0d66c2636d445257 Mon Sep 17 00:00:00 2001 From: Brightcells Date: Wed, 14 Mar 2018 18:46:59 +0800 Subject: [PATCH 1/3] :bug: Fix Bug: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 0: ordinal not in range(128) --- bson/codec.py | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bson/codec.py b/bson/codec.py index 0e582c8..9243c6d 100644 --- a/bson/codec.py +++ b/bson/codec.py @@ -19,6 +19,7 @@ import calendar import pytz +from CodeConvert import CodeConvert as cc from binascii import b2a_hex from six import integer_types, iterkeys, text_type, PY3 @@ -303,7 +304,7 @@ def decode_document(data, base, as_array=False): if PY3: value = value.decode("utf-8") else: - value = unicode(value) + value = cc.Convert2Unicode(value) base += 4 + length elif element_type == 0x03: # document base, value = decode_document(data, base) diff --git a/setup.py b/setup.py index 5bfe026..83a7ab7 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ def run(self): name="bson", version="0.5.2", packages=["bson"], - install_requires=["pytz>=2010b", "six>=1.9.0"], + install_requires=["CodeConvert>=2.0.4", "pytz>=2010b", "six>=1.9.0"], author="Ayun Park", author_email="iamparkayun@gmail.com", description="BSON codec for Python", From 33d8e3025a1ce7103254fd211f96554e0ca15697 Mon Sep 17 00:00:00 2001 From: Brightcells Date: Thu, 15 Mar 2018 21:44:59 +0800 Subject: [PATCH 2/3] :construction_worker: Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5e510c8..6fda885 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ python: - 3.5 - 3.6 install: -- pip install pytz>=2010b six>=1.9.0 +- pip install CodeConvert>=2.0.4 pytz>=2010b six>=1.9.0 - if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi script: - python test.py From 0a41b214aa785966b13a42aac1f3f0866c724a42 Mon Sep 17 00:00:00 2001 From: Brightcells Date: Thu, 15 Mar 2018 22:03:25 +0800 Subject: [PATCH 3/3] :arrow_up: Upgrading CodeConvert --- .travis.yml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6fda885..7455b7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ python: - 3.5 - 3.6 install: -- pip install CodeConvert>=2.0.4 pytz>=2010b six>=1.9.0 +- pip install CodeConvert>=2.0.5 pytz>=2010b six>=1.9.0 - if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi script: - python test.py diff --git a/setup.py b/setup.py index 83a7ab7..af761d9 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ def run(self): name="bson", version="0.5.2", packages=["bson"], - install_requires=["CodeConvert>=2.0.4", "pytz>=2010b", "six>=1.9.0"], + install_requires=["CodeConvert>=2.0.5", "pytz>=2010b", "six>=1.9.0"], author="Ayun Park", author_email="iamparkayun@gmail.com", description="BSON codec for Python",