diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2006-09-05 12:07:09 +0000 |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2006-09-05 12:07:09 +0000 |
commit | 199f1db1fa75e1f1b7cfe73259d6a811aa494a36 (patch) | |
tree | dafe1e12cea693de74824077b7871a3fdc4df5a2 /Lib | |
parent | d042132268d75461e157bd87a3f4358ce603d311 (diff) | |
download | cpython-git-199f1db1fa75e1f1b7cfe73259d6a811aa494a36.tar.gz |
Fix a few bugs on cjkcodecs found by Oren Tirosh:
- gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly.
- iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312
codepoints to conform the standard.
- iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 2013:2
codepoints now.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_codecencodings_cn.py | 2 | ||||
-rw-r--r-- | Lib/test/test_multibytecodec.py | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py index 1bf85834bc..c558f1bb99 100644 --- a/Lib/test/test_codecencodings_cn.py +++ b/Lib/test/test_codecencodings_cn.py @@ -32,6 +32,7 @@ class Test_GBK(test_multibytecodec_support.TestBase, unittest.TestCase): ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u804a"), ("\x83\x34\x83\x31", "strict", None), + (u"\u30fb", "strict", None), ) class Test_GB18030(test_multibytecodec_support.TestBase, unittest.TestCase): @@ -45,6 +46,7 @@ class Test_GB18030(test_multibytecodec_support.TestBase, unittest.TestCase): ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u804a"), ("abc\x84\x39\x84\x39\xc1\xc4", "replace", u"abc\ufffd\u804a"), + (u"\u30fb", "strict", "\x819\xa79"), ) has_iso10646 = True diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py index 397ebeb97a..800456e23b 100644 --- a/Lib/test/test_multibytecodec.py +++ b/Lib/test/test_multibytecodec.py @@ -202,6 +202,12 @@ class Test_ISO2022(unittest.TestCase): uni = u':hu4:unit\xe9 de famille' self.assertEqual(iso2022jp2.decode('iso2022-jp-2'), uni) + def test_iso2022_jp_g0(self): + self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2')) + for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'): + e = u'\u3406'.encode(encoding) + self.failIf(filter(lambda x: x >= '\x80', e)) + def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Test_MultibyteCodec)) |