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
7d9129c1
Commit
7d9129c1
authored
Mar 14, 2011
by
R David Murray
Browse files
Options
Browse Files
Download
Plain Diff
Merge long Japanese header fix from 3.2.
parents
a9b3a1c4
3a6152f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
Lib/email/charset.py
Lib/email/charset.py
+1
-1
Lib/email/test/test_email.py
Lib/email/test/test_email.py
+14
-0
No files found.
Lib/email/charset.py
View file @
7d9129c1
...
...
@@ -321,7 +321,7 @@ class Charset:
codec
=
self
.
output_codec
or
'us-ascii'
header_bytes
=
_encode
(
string
,
codec
)
encoder_module
=
self
.
_get_encoder
(
header_bytes
)
encoder
=
partial
(
encoder_module
.
header_encode
,
charset
=
str
(
self
)
)
encoder
=
partial
(
encoder_module
.
header_encode
,
charset
=
codec
)
# Calculate the number of characters that the RFC 2047 chrome will
# contribute to each line.
charset
=
self
.
get_output_charset
()
...
...
Lib/email/test/test_email.py
View file @
7d9129c1
...
...
@@ -725,6 +725,20 @@ wasnipoop; giraffes="very-long-necked-animals";
wasnipoop; giraffes="very-long-necked-animals";
\
t
spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"'''
)
def
test_header_encode_with_different_output_charset
(
self
):
h
=
Header
(
'文'
,
'euc-jp'
)
self
.
assertEqual
(
h
.
encode
(),
"=?iso-2022-jp?b?GyRCSjgbKEI=?="
)
def
test_long_header_encode_with_different_output_charset
(
self
):
h
=
Header
(
b'test-ja
\
xa4
\
xd8
\
xc5
\
xea
\
xb9
\
xc6
\
xa4
\
xb5
\
xa4
\
xec
\
xa4
'
b'
\
xbf
\
xa5
\
xe1
\
xa1
\
xbc
\
xa5
\
xeb
\
xa4
\
xcf
\
xbb
\
xca
\
xb2
\
xf1
\
xbc
\
xd4
'
b'
\
xa4
\
xce
\
xbe
\
xb5
\
xc7
\
xa7
\
xa4
\
xf2
\
xc2
\
xd4
\
xa4
\
xc3
\
xa4
\
xc6
\
xa4
'
b'
\
xa4
\
xa4
\
xde
\
xa4
\
xb9
'
.
decode
(
'euc-jp'
),
'euc-jp'
)
res
=
"""
\
=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKMnE8VCROPjUbKEI=?=
=?iso-2022-jp?b?GyRCRyckckJUJEMkRiQkJF4kORsoQg==?="""
self
.
assertEqual
(
h
.
encode
(),
res
)
def
test_header_splitter
(
self
):
eq
=
self
.
ndiffAssertEqual
msg
=
MIMEText
(
''
)
...
...
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