mirror of
https://github.com/django/django.git
synced 2025-03-13 19:00:45 +00:00
Payloads with surrogates are passed to the set_payload() since
f97f25ef5d
Backport of b231bcd19e57267ce1fc21d42d46f0b65fdcfcf8 from main.
This commit is contained in:
parent
a76c52b19a
commit
0d3ddcaf2c
@ -166,7 +166,8 @@ class SafeMIMEText(MIMEMixin, MIMEText):
|
||||
def set_payload(self, payload, charset=None):
|
||||
if charset == "utf-8" and not isinstance(charset, Charset.Charset):
|
||||
has_long_lines = any(
|
||||
len(line.encode()) > RFC5322_EMAIL_LINE_LENGTH_LIMIT
|
||||
len(line.encode(errors="surrogateescape"))
|
||||
> RFC5322_EMAIL_LINE_LENGTH_LIMIT
|
||||
for line in payload.splitlines()
|
||||
)
|
||||
# Quoted-Printable encoding has the side effect of shortening long
|
||||
|
Loading…
x
Reference in New Issue
Block a user