caronc / nzb-notify

Push Notifications to a large number of supported services for NZBGet and SABnzbd (based on Apprise)
GNU General Public License v3.0
129 stars 15 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte... #15

Closed rendo0m closed 7 years ago

rendo0m commented 7 years ago

Hi there,

this now works for me on sab, as i got this error: 2017-02-17 17:21:16,669::ERROR::[notifier:512] Script returned exit code 1 and output "2017-02-17 17:21:16,173 - 18457 - ERROR - Fatal Exception: Traceback (most recent call last): File "/Notify/nzbget/ScriptBase.py", line 2723, in run exit_code = main_function(*args, kwargs) File "/Notify.py", line 1102, in main notify_type=notify_type, File "/Notify/pnotify/Notify.py", line 894, in notify nobj.notify(body=body, title=title, notify_type=notify_type) File "/NotifyBase.py", line 380, in notify kwargs): File "/Notify/pnotify/NotifyTelegram.py", line 263, in _notify self.escape_html(title), File "/Notify/pnotify/NotifyBase.py", line 318, in escape_html replace(u'\t', u' ').\ UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128) (dir shortened) I did no more research, it just works now. THX

caronc commented 7 years ago

Thanks for your efforts, but unfortunately I can't accept this pull request. I'm a little discouraged by the setdefaultencoding() hack. It's pretty much documented everywhere that even though this appears to fix a lot of problems for (English speaking) people, it really just masks the problem and breaks it for anything that 'isn't' utf-8 (or share common entries to it such as Latin-1 - English/French/Spanish). People overseas (who use different system encodings) won't be able to use the script anymore if I force everything to utf-8.

That all said, clearly there is a bug here! :stuck_out_tongue_winking_eye: Obviously I'm not handling extended character sets properly. So I will definitely dig deeper into this and see what I can find. In the meantime; I'm glad you found your own fix (as your solution will definitely work for you)! I also appreciate you pointing out this bug; thank you!

rendo0m commented 7 years ago

Thanks for reply. Still works like a charm. :-) I changed the topic, maybe someone else needs help in this case. Closed!