Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_csv function invalid start byte #13

Open
ghost opened this issue Feb 23, 2020 · 0 comments
Open

get_csv function invalid start byte #13

ghost opened this issue Feb 23, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Feb 23, 2020

i use the get_csv function ,in python3.7, but some time will devodeError,
error code on :
https://github.com/guinslym/pyexifinfo/blob/master/pyexifinfo/pyexifinfo.py#L141

I local fix it use this function ,replace s = s.decode('utf-8'), can fix it ,please update

def byte_to_str(byte_str):
if isinstance(byte_str, str):
return byte_str
chard = chardet.detect(byte_str)
if chard.get('encoding'):
byte_str = byte_str.decode(chard['encoding'], 'ignore')
else:
byte_str = byte_str.decode('utf8', 'ignore')
return byte_str

error info:

File "/opt/venv3/lib/python3.7/site-packages/pyexifinfo/pyexifinfo.py", line 143, in get_csv
s = s.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 1313: invalid start byte

@ghost ghost changed the title get_csv function get_csv function invalid start byte Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants