1
0
Fork 0

nntp: fix bad behaviour with UTF-8 encoded headers

Read-Also: https://tools.ietf.org/html/rfc3977
This commit is contained in:
nemunaire 2019-09-10 15:50:17 +02:00
parent 4499677d55
commit 644a641b13
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@
# PYTHON STUFFS #######################################################
import email
import email.policy
from email.utils import mktime_tz, parseaddr, parsedate_tz
from functools import partial
from nntplib import NNTP, decode_header
@ -45,7 +46,8 @@ def read_group(group, **server):
def read_article(msg_id, **server):
with NNTP(**server) as srv:
response, info = srv.article(msg_id)
return email.message_from_bytes(b"\r\n".join(info.lines))
return email.message_from_bytes(b"\r\n".join(info.lines), policy=email.policy.SMTPUTF8)
def whatsnew(date_last_check, group="*", **server):
fill = dict()