hipspy / hips

Python library to handle HiPS
https://hips.readthedocs.io
13 stars 16 forks source link

UTF-8 decode invalid start byte error #29

Closed adl1995 closed 7 years ago

adl1995 commented 7 years ago

This issue concerns #27. When a byte is decoded using: text = response.decode('utf-8'), this error comes up:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 83958: invalid start byte

For now the workaround is to simply use str(response).

cdeil commented 7 years ago

I fixed this here: https://github.com/hipspy/hips/pull/27/files#diff-0fe71e698f361724cee17a858a30ebc0R71

Simply calling str(response) doesn't work properly, it inserts this repr for the bytes string that starts with "b" into the string. Example:

>>> str(b'spam')
"b'spam'"