mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #23919 -- Removed default 'utf-8' argument for str.encode()/decode().
This commit is contained in:
@@ -172,7 +172,7 @@ class SafeMIMEText(MIMEMixin, MIMEText):
|
||||
def set_payload(self, payload, charset=None):
|
||||
if charset == 'utf-8':
|
||||
has_long_lines = any(
|
||||
len(l.encode('utf-8')) > RFC5322_EMAIL_LINE_LENGTH_LIMIT
|
||||
len(l.encode()) > RFC5322_EMAIL_LINE_LENGTH_LIMIT
|
||||
for l in payload.splitlines()
|
||||
)
|
||||
# Quoted-Printable encoding has the side effect of shortening long
|
||||
@@ -322,7 +322,7 @@ class EmailMessage:
|
||||
if basetype == 'text':
|
||||
if isinstance(content, bytes):
|
||||
try:
|
||||
content = content.decode('utf-8')
|
||||
content = content.decode()
|
||||
except UnicodeDecodeError:
|
||||
# If mimetype suggests the file is text but it's
|
||||
# actually binary, read() raises a UnicodeDecodeError.
|
||||
|
||||
Reference in New Issue
Block a user