vaidik / commentjson

Add JavaScript or Python style comments in JSON.
MIT License
104 stars 25 forks source link

Can't load UTF-8 json files on 0.7.1 #19

Closed rwack closed 5 years ago

rwack commented 5 years ago
>>> 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.

vaidik commented 5 years ago

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

vaidik commented 5 years ago

This is fixed and released in version 0.7.2