gustavo-iniguez-goya / opensnitch

OpenSnitch is a GNU/Linux application firewall
GNU General Public License v3.0
395 stars 20 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 #5

Closed logix2 closed 4 years ago

logix2 commented 4 years ago

When I try to run opensnitch-ui on Ubuntu 19.10, I get this error:

$ opensnitch-ui 

Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
Traceback (most recent call last):
  File "/usr/bin/opensnitch-ui", line 47, in <module>
    service = UIService(app, on_exit)
  File "/usr/lib/python3/dist-packages/opensnitch/service.py", line 46, in __init__
    self._prompt_dialog = PromptDialog()
  File "/usr/lib/python3/dist-packages/opensnitch/dialogs/prompt.py", line 56, in __init__
    self._apps_parser = LinuxDesktopParser()
  File "/usr/lib/python3/dist-packages/opensnitch/desktop_parser.py", line 35, in __init__
    self._parse_desktop_file(desktop_file)
  File "/usr/lib/python3/dist-packages/opensnitch/desktop_parser.py", line 60, in _parse_desktop_file
    parser.read(desktop_path, 'utf8')
  File "/usr/lib/python3.7/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/usr/lib/python3.7/configparser.py", line 1014, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 121: invalid continuation byte

I see this was reported for the original OpenSnitch project too: https://github.com/evilsocket/opensnitch/issues/227 but it was never fixed.

gustavo-iniguez-goya commented 4 years ago

Ok, I'll take a look into it. In the meantime, what Window Manager are you using?

logix2 commented 4 years ago

I use GNOME Shell.

gustavo-iniguez-goya commented 4 years ago

Ok, I've tested it on Ubuntu 19.10 with en_US locale and works fine. It looks like it is related to the translations on the *.desktop files (/usr/share/applications/). I'm going to try to reproduce and fix it, but in any case it shouldn't crash, so maybe I'll push a fix to return a default icon.

gustavo-iniguez-goya commented 4 years ago

Hey @logix2 , I've added a workaround to solve this problem. Can you copy the file https://github.com/gustavo-iniguez-goya/opensnitch/blob/main/ui/opensnitch/desktop_parser.py to _/usr/lib/python3/dist-packages/opensnitch/desktopparser.py and check if it doesn't crash?

logix2 commented 4 years ago

It works now, thanks a lot!

gustavo-iniguez-goya commented 4 years ago

Thank you for the feedback, I'll publish a new version release later :)

gustavo-iniguez-goya commented 4 years ago

fixed in v1.0.0rc-5 release.