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
8e1e7f54
Commit
8e1e7f54
authored
Mar 07, 2003
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decode_rfc2231(): RFC 2231 allows leaving out both the charset and
language without including any single quotes.
parent
21fcc4e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
Lib/email/Utils.py
Lib/email/Utils.py
+7
-5
No files found.
Lib/email/Utils.py
View file @
8e1e7f54
...
...
@@ -280,9 +280,11 @@ def unquote(str):
def
decode_rfc2231
(
s
):
"""Decode string according to RFC 2231"""
import
urllib
charset
,
language
,
s
=
s
.
split
(
"'"
,
2
)
s
=
urllib
.
unquote
(
s
)
return
charset
,
language
,
s
parts
=
s
.
split
(
"'"
,
2
)
if
len
(
parts
)
==
1
:
return
None
,
None
,
s
charset
,
language
,
s
=
parts
return
charset
,
language
,
urllib
.
unquote
(
s
)
def
encode_rfc2231
(
s
,
charset
=
None
,
language
=
None
):
...
...
@@ -335,6 +337,6 @@ def decode_params(params):
for
num
,
continuation
in
continuations
:
value
.
append
(
continuation
)
charset
,
language
,
value
=
decode_rfc2231
(
EMPTYSTRING
.
join
(
value
))
new_params
.
append
(
(
name
,
(
charset
,
language
,
'"%s"'
%
quote
(
value
))))
new_params
.
append
(
(
name
,
(
charset
,
language
,
'"%s"'
%
quote
(
value
))))
return
new_params
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