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

unicode error: UnicodeDecodeError: 'utf8' codec can't decode byte 0xa9 in position 15: invalid start byte #21

Open
lcorsini opened this issue Apr 6, 2018 · 1 comment

Comments

@lcorsini
Copy link

lcorsini commented Apr 6, 2018

when downloading I've encountered this error (python 2.7 on windows)

Traceback (most recent call last):
  File "downloader.py", line 374, in <module>
    main(sys.argv[1:])
  File "downloader.py", line 332, in main
    download_book(book, books_directory, book_assets, session, headers)
  File "downloader.py", line 101, in download_book
    print(title.encode(sys.stdout.encoding, errors='replace').decode())
  File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa9 in position 15: invalid start byte

There is a way to see what is the book that causes this error?

@lcorsini
Copy link
Author

lcorsini commented Apr 6, 2018

well it seems easy, I actually replaced the line
print(title.encode(sys.stdout.encoding, errors='replace').decode())
with:
print(title.encode(sys.stdout.encoding, errors='ignore').decode('unicode_escape').encode('utf-8'))

the culprit was the registered mark character (the book was:
Learning Unreal® Engine iOS Game Development)

@ApCoder123 ApCoder123 mentioned this issue May 11, 2018
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

1 participant