diff --git a/.travis.yml b/.travis.yml index 5e510c8..7455b7e 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.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/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..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=["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",