otsaloma / gaupol

Editor for text-based subtitle files
https://otsaloma.io/gaupol/
GNU General Public License v3.0
247 stars 35 forks source link

ValueError: Code 'cp65001' not found #192

Closed Leon0824 closed 2 years ago

Leon0824 commented 2 years ago

Hi! I got this error when clicking the 'Open' button.

Traceback

File: C:\Users\osa\Desktop\gaupol-1.3.1\aeidon\deco.py
Line: 218
In: inner_wrapper

File: C:\Users\osa\Desktop\gaupol-1.3.1\gaupol\agents\open.py
Line: 203
In: _on_open_main_files_activate

File: C:\Users\osa\Desktop\gaupol-1.3.1\gaupol\agents\open.py
Line: 303
In: _select_files

File: C:\Users\osa\Desktop\gaupol-1.3.1\gaupol\dialogs\open.py
Line: 44
In: __init__

File: C:\Users\osa\Desktop\gaupol-1.3.1\gaupol\dialogs\file.py
Line: 46
In: _init_encoding_combo

File: C:\Users\osa\Desktop\gaupol-1.3.1\gaupol\dialogs\file.py
Line: 110
In: _populate_encoding_combo

File: C:\Users\osa\Desktop\gaupol-1.3.1\aeidon\encodings.py
Line: 158
In: code_to_long_name

ValueError: Code 'cp65001' not found

Environment

Platform: Windows-10-10.0.22000
Locale: zh_TW.cp65001

Versions

aeidon: 1.3.1
chardet: 2.3.0
enchant: None
gaupol: 1.3.1
gstreamer: None
gtk+: 3.18.9
pygobject: 3.24.1
python: 3.4.4
otsaloma commented 2 years ago

It seems cp65001 was added in Python 3.3, which I missed, but since Python 3.8 it's just an alias for UTF-8. So, there's nothing really to fix anymore, although I could add a test to make sure that no encodings are missed.

I'm not sure if you can work around that. You can try to go into the preferences dialog, uncheck "Current locale encoding" and put "Unicode (UTF-8)" into the "Fallback encodings" list. Maybe then it wouldn't try to use cp65001 and if cp65001 is indeed UTF-8, it should just work.

Leon0824 commented 2 years ago

Hi, I tried the work around. The exact same error occurs.

otsaloma commented 2 years ago

Maybe you have cp65001 in the config file? You can try editing the encoding and file sections of the config file %APPDATA%\Gaupol\gaupol.conf as follows. Still not sure it'll work, but if you do have cp65001 mentions in the config file that would be a problem.

[encoding]
fallback = ["utf_8"]
try_locale = false
visible = ["utf_8"]

[file]
encoding = "utf_8"
Leon0824 commented 2 years ago

It does not work. I just noticed that Gaupol for Windows was stoped at 1.3.1. 😮

Whatever, I figured out a work around. Using Locale Emulator to launch Gaupol in other locale. And another way is switching to Linux. I am a dual-boot guy. 🤓

otsaloma commented 2 years ago

Yeah, I stopped making those Windows installers (#189), so best I can try to offer is work-arounds when issues are found.

Glad it works somehow. And if you do use Linux, Gaupol is much better there.