Show More
@@ -15,6 +15,8 b' Authors:' | |||
|
15 | 15 | import os |
|
16 | 16 | from urllib import quote, unquote |
|
17 | 17 | |
|
18 | from IPython.utils import py3compat | |
|
19 | ||
|
18 | 20 | #----------------------------------------------------------------------------- |
|
19 | 21 | # Imports |
|
20 | 22 | #----------------------------------------------------------------------------- |
@@ -54,13 +56,16 b' def url_escape(path):' | |||
|
54 | 56 | |
|
55 | 57 | Turns '/foo bar/' into '/foo%20bar/' |
|
56 | 58 | """ |
|
57 | parts = path.split('/') | |
|
58 | return '/'.join([quote(p) for p in parts]) | |
|
59 | parts = py3compat.unicode_to_str(path).split('/') | |
|
60 | return u'/'.join([quote(p) for p in parts]) | |
|
59 | 61 | |
|
60 | 62 | def url_unescape(path): |
|
61 | 63 | """Unescape special characters in a URL path |
|
62 | 64 | |
|
63 | 65 | Turns '/foo%20bar/' into '/foo bar/' |
|
64 | 66 | """ |
|
65 | return '/'.join([unquote(p) for p in path.split('/')]) | |
|
67 | return u'/'.join([ | |
|
68 | py3compat.str_to_unicode(unquote(p)) | |
|
69 | for p in py3compat.unicode_to_str(path).split('/') | |
|
70 | ]) | |
|
66 | 71 |
General Comments 0
You need to be logged in to leave comments.
Login now