vaidik / commentjson

Add JavaScript or Python style comments in JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't load UTF-8 json files on 0.7.1

rwack opened this issue · comments

>>> import commentjson
>>> file = open('myfile.json')
>>> data = commentjson.load(file)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xxx/.local/lib/python2.7/site-packages/commentjson/commentjson.py", line 117, in load
    raise JSONLibraryException(e)
commentjson.commentjson.JSONLibraryException: JSON Library Exception

Exception thrown by JSON library (json): 

    Traceback (most recent call last):
      File "/home/xxx/.local/lib/python2.7/site-packages/commentjson/commentjson.py", line 115, in load
        return loads(fp.read(), **kwargs)
      File "/home/xxx/.local/lib/python2.7/site-packages/commentjson/commentjson.py", line 71, in loads
        lines = text.split('\n')
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 128: ordinal not in range(128)

This issue does not happen on 0.6.0 using the same file.

Can you share your the file you are trying to parse?

This is fixed and released in version 0.7.2