Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3798ae0f
Commit
3798ae0f
authored
Dec 27, 2010
by
R. David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1379416: encode charset name to ascii to avoid unicode promotion of output
parent
cb7e3eef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
Lib/email/charset.py
Lib/email/charset.py
+1
-1
Lib/email/test/test_email.py
Lib/email/test/test_email.py
+7
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/email/charset.py
View file @
3798ae0f
...
...
@@ -209,7 +209,7 @@ class Charset:
input_charset
=
unicode
(
input_charset
,
'ascii'
)
except
UnicodeError
:
raise
errors
.
CharsetError
(
input_charset
)
input_charset
=
input_charset
.
lower
()
input_charset
=
input_charset
.
lower
()
.
encode
(
'ascii'
)
# Set the input charset after filtering through the aliases and/or codecs
if
not
(
input_charset
in
ALIASES
or
input_charset
in
CHARSETS
):
try
:
...
...
Lib/email/test/test_email.py
View file @
3798ae0f
...
...
@@ -3140,6 +3140,13 @@ A very long line that must get split to something other than at the
'attachment; filename*="iso-8859-1
\
'
\
'
Fu%DFballer.ppt"'
,
msg
[
'Content-Disposition'
])
def
test_encode_unaliased_charset
(
self
):
# Issue 1379416: when the charset has no output conversion,
# output was accidentally getting coerced to unicode.
res
=
Header
(
'abc'
,
'iso-8859-2'
).
encode
()
self
.
assertEqual
(
res
,
'=?iso-8859-2?q?abc?='
)
self
.
assertIsInstance
(
res
,
str
)
# Test RFC 2231 header parameters (en/de)coding
class
TestRFC2231
(
TestEmailBase
):
...
...
Misc/NEWS
View file @
3798ae0f
...
...
@@ -22,6 +22,9 @@ Core and Builtins
Library
-------
- Issue #1379416: eliminated a source of accidental unicode promotion in
email.header.Header.encode.
- Issue #5258/#10642: if site.py encounters a .pth file that generates an error,
it now prints the filename, line number, and traceback to stderr and skips
the rest of that individual file, instead of stopping processing entirely.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment