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

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 328: character maps to <undefined> #2672

Closed
lazka opened this Issue Dec 29, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@lazka
Member

lazka commented Dec 29, 2017

https://sentry.io/quodlibet/quodlibet/issues/425434407/

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 328: character maps to <undefined>
  File "quodlibet/qltk/songsmenu.py", line 156, in __on_activate
    self.__handle(item, plugin, library, songs, parent)
  File "quodlibet/qltk/songsmenu.py", line 216, in __handle
    if any(ret):
  File "quodlibet/ext/songsmenu/importexport.py", line 153, in plugin_album
    for line in open(fn, 'rU'):
  File "cp1252.py", line 23, in decode

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 328: character maps to <undefined>

@lazka lazka added the sentry label Dec 29, 2017

@lazka

This comment has been minimized.

Member

lazka commented Dec 29, 2017

I guess I forgot to review the open() calls :/

@lazka lazka closed this in 396ee9e Jan 1, 2018

@lazka lazka added this to the 4.0.1 milestone Jan 4, 2018

lazka added a commit that referenced this issue Jan 10, 2018

Fix various places not specifying an encoding with open(). Fixes #2672.
Fixes #2671

So we do the same thing independent of the locale.
Also remove the universal newline flag, as it's the default with Python 3.
@futurespoir

This comment has been minimized.

futurespoir commented Jun 6, 2018

You have to find the correct encoding. Common ones are Latin-1 and UTF-8. and you have to specify the encoding when you open the file:
exemple :
file = open(filename, encoding="utf8")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment