diff options
-rw-r--r-- | Lib/urllib.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index 0644ecd..e44f6b1 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -693,6 +693,12 @@ def unquote(s): i = j+3 return string.joinfields(res, '') +def unquote_plus(s): + if '+' in s: + import regsub + s = regsub.gsub('+', ' ', s) + return unquote(s) + always_safe = string.letters + string.digits + '_,.-' def quote(s, safe = '/'): safe = always_safe + safe @@ -704,6 +710,14 @@ def quote(s, safe = '/'): res.append('%%%02x' % ord(c)) return string.joinfields(res, '') +def quote_plus(s, safe = '/'): + if ' ' in s: + import regsub + s = regsub.gsub(' ', '+', s) + return quote(s, safe + '+') + else: + return quote(s, safe) + # Proxy handling def getproxies(): |