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
687a374e
Commit
687a374e
authored
Oct 15, 2005
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach unquote() to handle unicode inputs
parent
032b5184
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
Lib/test/test_urllib.py
Lib/test/test_urllib.py
+4
-0
Lib/urllib.py
Lib/urllib.py
+2
-0
No files found.
Lib/test/test_urllib.py
View file @
687a374e
...
...
@@ -415,6 +415,10 @@ class UnquotingTests(unittest.TestCase):
self.assertEqual(expect, result,
"using unquote_plus(): %s != %s" % (expect, result))
def test_unquote_with_unicode(self):
r = urllib.unquote(u'
br
%
C3
%
BCckner_sapporo_20050930
.
doc
')
self.assertEqual(r, u'
br
\
xc3
\
xbcckner_sapporo_20050930
.
doc
')
class urlencode_Tests(unittest.TestCase):
"""Tests for urlencode()"""
...
...
Lib/urllib.py
View file @
687a374e
...
...
@@ -1061,6 +1061,8 @@ def unquote(s):
res
[
i
]
=
_hextochr
[
item
[:
2
]]
+
item
[
2
:]
except
KeyError
:
res
[
i
]
=
'%'
+
item
except
UnicodeDecodeError
:
res
[
i
]
=
unichr
(
int
(
item
[:
2
],
16
))
+
item
[
2
:]
return
""
.
join
(
res
)
def
unquote_plus
(
s
):
...
...
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