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

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 31448: invalid continuation byte (problem with locale ?) #201

Open
julienm116 opened this issue Oct 14, 2024 · 2 comments

Comments

@julienm116
Copy link

greetings folks :)

it's been some time since i've been having this error when starting menulibre (version 2.4.0):

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/menulibre/MenulibreApplication.py", line 1652, in do_activate
    self.win = MenulibreWindow(self, headerbar)  # type: ignore
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/menulibre/MenulibreApplication.py", line 110, in __init__
    self.bad_desktop_files = util.determine_bad_desktop_files()
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/menulibre/util.py", line 741, in determine_bad_desktop_files
    for line in result.stderr.decode('UTF-8').split('\n'):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 31448: invalid continuation byte

(then hangs forever)

here are my last try's locale :

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="C.utf8"
LC_NUMERIC="C.utf8"
LC_TIME="C.utf8"
LC_COLLATE="C.utf8"
LC_MONETARY="C.utf8"
LC_MESSAGES="C.utf8"
LC_PAPER="C.utf8"
LC_NAME="C.utf8"
LC_ADDRESS="C.utf8"
LC_TELEPHONE="C.utf8"
LC_MEASUREMENT="C.utf8"
LC_IDENTIFICATION="C.utf8"
LC_ALL=C.utf8

(note i'm in France but except for a few specific locale types, i usually use en_US.UTF-8 and no LC_ALL)

i've tried several LC_ALL value (C, C.utf8,...) but i always hit the UnicodeDecodeError with different 'codec' (whatever that may be) and i couldn't find a thread explaining what what the issue nor how to fix it

this makes me really desperate ! if someone could lend me a hand with this please i would greatly appreciate it ^^

tia,
-J.

@julienm116 julienm116 changed the title problem with locale ? UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 31448: invalid continuation byte (problem with locale ?) Oct 16, 2024
@julienm116
Copy link
Author

replying to myself, as this may help others like me clueless in python

here is the workaround i found while trying tinkering, i edited /usr/lib/python3/dist-packages/menulibre/util.py (adapt to your install path), line 741 was : for line in result.stderr.decode('UTF-8').split('\n'): in sub-routine def determine_bad_desktop_files():
i replaced UTF-8 with ISO-8859-1 in decode argument (i guess that depending on your language you may need to adapt which encoding to use )

once this change was made application was working anew 🎉

i must have somewhere an item with specific latin-1 character that doesn't exist in UTF-8, however it shouldn't stop the application from starting (even it just displays some undef char when stumbling upon the unknown ones, imho)

there might be a better way to fix this, but ... afaic whatever works

@julienm116
Copy link
Author

(re-opening for a while, in case someone has a better fix)

@julienm116 julienm116 reopened this Oct 16, 2024
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