]> granicus.if.org Git - python/commitdiff
Fix #883466: don't allow Unicode as arguments to quopri and uu codecs.
authorGeorg Brandl <georg@python.org>
Mon, 3 Sep 2007 07:16:46 +0000 (07:16 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 3 Sep 2007 07:16:46 +0000 (07:16 +0000)
Lib/encodings/quopri_codec.py
Lib/encodings/uu_codec.py

index b802ae62d2a20565beacb16648237f43cc659488..d8683fd56d325415a25116c129ab41ae45126016 100644 (file)
@@ -18,7 +18,8 @@ def quopri_encode(input, errors='strict'):
 
     """
     assert errors == 'strict'
-    f = StringIO(input)
+    # using str() because of cStringIO's Unicode undesired Unicode behavior.
+    f = StringIO(str(input))
     g = StringIO()
     quopri.encode(f, g, 1)
     output = g.getvalue()
@@ -33,7 +34,7 @@ def quopri_decode(input, errors='strict'):
 
     """
     assert errors == 'strict'
-    f = StringIO(input)
+    f = StringIO(str(input))
     g = StringIO()
     quopri.decode(f, g)
     output = g.getvalue()
index 43fb93c1b7f4823eaa33b6d0268116c9b7d49fb5..fb03758171d1218ad023f7a092584baa28111883 100644 (file)
@@ -25,7 +25,8 @@ def uu_encode(input,errors='strict',filename='<data>',mode=0666):
     assert errors == 'strict'
     from cStringIO import StringIO
     from binascii import b2a_uu
-    infile = StringIO(input)
+    # using str() because of cStringIO's Unicode undesired Unicode behavior.
+    infile = StringIO(str(input))
     outfile = StringIO()
     read = infile.read
     write = outfile.write
@@ -60,7 +61,7 @@ def uu_decode(input,errors='strict'):
     assert errors == 'strict'
     from cStringIO import StringIO
     from binascii import a2b_uu
-    infile = StringIO(input)
+    infile = StringIO(str(input))
     outfile = StringIO()
     readline = infile.readline
     write = outfile.write