Commits

Hye-Shik Chang  committed dda4241

Backport from trunk r42989:

Bug #1448490: Fixed a bug that ISO-2022 codecs could not handle
SS2 (single-shift 2) escape sequences correctly.

  • Participants
  • Parent commits 4309b3f
  • Branches 2.4

Comments (0)

Files changed (3)

File Lib/test/test_multibytecodec.py

         wr.write('abcd')
         self.assertEqual(s.getvalue(), 'abcd')
 
+class Test_ISO2022(unittest.TestCase):
+    def test_g2(self):
+        iso2022jp2 = '\x1b(B:hu4:unit\x1b.A\x1bNi de famille'
+        uni = u':hu4:unit\xe9 de famille'
+        self.assertEqual(iso2022jp2.decode('iso2022-jp-2'), uni)
+
 def test_main():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(Test_StreamWriter))
+    suite.addTest(unittest.makeSuite(Test_ISO2022))
     test_support.run_suite(suite)
 
 if __name__ == "__main__":
 Extension Modules
 -----------------
 
+- Bug #1448490: Fixed a bug that ISO-2022 codecs could not handle
+  SS2 (single-shift 2) escape sequences correctly.
+
 - Bug #854823: socketmodule now builds on Sun platforms even when
   INET_ADDRSTRLEN is not defined.
 

File Modules/cjkcodecs/_codecs_iso2022.c

 	(*inbuf) += 3;
 	*inleft -= 3;
 	(*outbuf) += 1;
-	*outbuf -= 1;
+	*outleft -= 1;
 	return 0;
 }