]> granicus.if.org Git - python/commitdiff
Anonymous SF bug 129288: "The python 2.0 urllib has %%%x as a format
authorGuido van Rossum <guido@python.org>
Fri, 19 Jan 2001 03:28:15 +0000 (03:28 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 19 Jan 2001 03:28:15 +0000 (03:28 +0000)
when quoting forbidden characters. There are scripts out there that
break with lower case, therefore I guess %%%X should be used."

I agree, so am fixing this.

Lib/urllib.py

index cd22766670e2e744f8abb65fc0f04d71d0e40998..61fac28f02863c9395f52eba6dc3f8f0ad9dbcc0 100644 (file)
@@ -1049,7 +1049,7 @@ def _fast_quote(s):
     for i in range(len(res)):
         c = res[i]
         if not _fast_safe.has_key(c):
-            res[i] = '%%%02x' % ord(c)
+            res[i] = '%%%02X' % ord(c)
     return ''.join(res)
 
 def quote(s, safe = '/'):
@@ -1080,7 +1080,7 @@ def quote(s, safe = '/'):
     for i in range(len(res)):
         c = res[i]
         if c not in safe:
-            res[i] = '%%%02x' % ord(c)
+            res[i] = '%%%02X' % ord(c)
     return ''.join(res)
 
 def quote_plus(s, safe = ''):