]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix another Python 2/3 code merge unicode issue.
authorBob Halley <halley@dnspython.org>
Sat, 18 Jun 2016 13:51:36 +0000 (06:51 -0700)
committerBob Halley <halley@dnspython.org>
Sat, 18 Jun 2016 13:51:36 +0000 (06:51 -0700)
dns/name.py
tests/test_name.py

index 7a874b8242a7e8f53cf826b760889f902c27b378..5d017a35d53799f9984d34ac9a91a245964929ca 100644 (file)
@@ -123,7 +123,7 @@ def _escapify(label, unicode_mode=False):
             if c >= u'\x7f':
                 text += c
             else:
-                text += u'\\%03d' % c
+                text += u'\\%03d' % ord(c)
     return text
 
 
index a166a3e860a02a1ec41f5f7198b9bb4bd3ef256f..645cf75918c9070280abcf2fff6f0cffb9aa7820 100644 (file)
@@ -237,6 +237,11 @@ class NameTestCase(unittest.TestCase):
         t = n.to_text()
         self.assertEqual(t, b'FOO\.bar')
 
+    def testToText9(self):
+        n = dns.name.from_text(r'\x80\.bar', origin=None)
+        t = n.to_text()
+        self.assertEqual(t, br'x80\.bar')
+
     def testSlice1(self):
         n = dns.name.from_text(r'a.b.c.', origin=None)
         s = n[:]