emericg / OpenSubtitlesDownload

Automatically find and download the right subtitles for your favorite videos!
https://emeric.io/OpenSubtitlesDownload
GNU General Public License v3.0
595 stars 66 forks source link

Unable to change encoding from CP1250 to UTF-8 #58

Closed kodkuce closed 3 years ago

kodkuce commented 4 years ago

Unknown GUI, falling back to an automatic CLI mode

Downloading 'Serbian' subtitles for '"His Dark Materials" Armour' OpenSubtitlesDownload encountered an unknown error, sorry about that... Error: [class 'urllib.error.HTTPError'] Line: 831 Just to be safe, please check....

i wraped it with try except and it gived mi then Error: [class 'NameError'] ...

so i printed subURL https://dl.opensubtitles.org/en/download/subencoding-utf8/src-api/vrf-19e20c60/sid-rFCWEiFomr8tErX25XQnxKuH8B0/filead/1956564919.gz in browser it shows [CRITICAL ERROR] Unable to change encoding from CP1250 to UTF-8 ! hmm so fast fix i just changed subencoding-utf8 to subencoding-utf and it now works kinda but ye you need to wrap this up i guess :)

emericg commented 4 years ago

Hi, Thank you for investigating this issue! Unfortunately this is an opensubtitles.org bug. Does it happen often? And with the way OpenSubtitlesDownload is downloading the subtitles in GUI mode, we can't detect that error. I could work on this for CLI though...

You can disable the utf8 conversion by setting this setting to false:

# Force downloading and storing UTF-8 encoded subtitles files.
opt_force_utf8 = False

I suspect by setting an invalid encoding ("utf") you achieved the same thing.

emericg commented 3 years ago

New versions won't force UTF-8 by default.