Description
So I know there are already few suggestions flying around about this ascii<->utf-8 encoding/non-printable characters, but somehow the solutions described in https://github.com/pyload/pyload/issues/2291 && https://github.com/pyload/pyload/issues/3283 did not solve the issue for me. I still got "UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 48: ordinal not in range(128)"...
So some debug statements, and few hours later, I eventually got a workaround, that fixed the issue for me. Basically the issue is that in the title of some links there are special chars(umlauts in my case). What I decided to do, is to replace these with an underscore. It's probably not nice (as the character is replaced), but it's functional and I anyway didn't like umlauts in the filename on my NAS.
I guess you might aim to fix this encoding issue the right way, but until that's happened, the below could save some people some headaches and take away some frustration.
PS: I really love the work you do here with pyload. It's pretty lightweight compared with other download managers... If you dislike people pokeing around in your code and send reports like this, let me know:).
in /opt/pyload/userplugins/internal/misc.py
`def decode(value, encoding=None, errors='strict'):
"""
Encoded string (default to own system encoding) -> unicode string
"""
if isinstance(value, str):
#res = unicode(value, encoding or get_console_encoding(sys.stdout.encoding), errors)
#res = unicode(value, encoding or get_console_encoding(sys.stdout.encoding), errors='ignore')
res = unicode(value, encoding or 'cp1252', errors='ignore')`
in [CONFIGDIR]/userplugins/internal/Base.py
Note, nothing was replaced, just the lines after the # below
`...
import unicodedata, re, sys
...
def grab_info(self):
self.log_info(_("Grabbing link info..."))
old_info = dict(self.info)
new_info = self.get_info(replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS), self.data)
#update new_info by twt aka anon_helper:
self.log_debug("twt: new info name is %s" % new_info['name'])
encodinghack = new_info['name']
encodinghack = encodinghack.replace(u'\ufffd', '_')
self.log_debug("twt: what if we just call it %s" % encodinghack)
new_info['name'] = encodinghack`
Debug log
I should really slap myself... Sorry the logs were already rotated... I have however the debug reports if that's of any use to you.
I'm not used to report issues, I'm rather going and fixing stuff... Let me add the debug file, in the hope, that you have some useful information in case you decide to pursue this issue.
debug_DdownloadCom_24-05-2021_10-59-31.zip
TRACEBACK:
Traceback (most recent call last):
File "/usr/share/pyload/module/PluginThread.py", line 187, in run
pyfile.plugin.preprocessing(self)
File "/opt/pyload/userplugins/internal/Base.py", line 291, in preprocessing
return self._process(*args, **kwargs)
File "/opt/pyload/userplugins/internal/Hoster.py", line 118, in process
self.process(self.pyfile)
File "/opt/pyload/userplugins/internal/SimpleHoster.py", line 253, in process
self.log_info(("pyfile" + str(pyfile)))
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 48: ordinal not in range(128)
Additional references
Screenshots
bug pyLoad Stable