* enc/trans/gb18030-tbl.rb: Fix omission of C1 region in code table

(from Tatsuya Mizuno)

* test/ruby/test_transcode.rb: Added test for converting full range of
  Unicode codepoints from/to GB18030 (from Tatsuya Mizuno)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2009-12-03 11:29:33 +00:00
Родитель 342ed0ab03
Коммит 9998481d4e
3 изменённых файлов: 48 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Thu Dec 3 20:27:27 2009 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/trans/gb18030-tbl.rb: Fix omission of C1 region in code table
(from Tatsuya Mizuno)
* test/ruby/test_transcode.rb: Added test for converting full range of
Unicode codepoints from/to GB18030 (from Tatsuya Mizuno)
Wed Dec 2 23:51:28 2009 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* ext/openssl/ossl_ssl.c: initialize @hostname of SSLSocket to avoid

Просмотреть файл

@ -1,4 +1,36 @@
GB18030_TO_UCS_TBL = [
["81308130",0x80],
["81308131",0x81],
["81308132",0x82],
["81308133",0x83],
["81308134",0x84],
["81308135",0x85],
["81308136",0x86],
["81308137",0x87],
["81308138",0x88],
["81308139",0x89],
["81308230",0x8A],
["81308231",0x8B],
["81308232",0x8C],
["81308233",0x8D],
["81308234",0x8E],
["81308235",0x8F],
["81308236",0x90],
["81308237",0x91],
["81308238",0x92],
["81308239",0x93],
["81308330",0x94],
["81308331",0x95],
["81308332",0x96],
["81308333",0x97],
["81308334",0x98],
["81308335",0x99],
["81308336",0x9A],
["81308337",0x9B],
["81308338",0x9C],
["81308339",0x9D],
["81308430",0x9E],
["81308431",0x9F],
["81308432",0xA0],
["81308433",0xA1],
["81308434",0xA2],

Просмотреть файл

@ -1578,7 +1578,13 @@ class TestTranscode < Test::Unit::TestCase
end
def test_gb18030
# test from GBK
# overall roundtrip test
all_gb18030 = (0x0..0xD7FF).to_a.pack 'U*' #追加
all_gb18030 << (0xE000..0xFFFF).to_a.pack("U*") #追加
assert_equal(all_gb18030, all_gb18030.encode("gb18030").encode("UTF-8")) #追加
# tests from GBK
check_both_ways("\u4E02", "\x81\x40", 'GB18030') #
check_both_ways("\u4E8A", "\x81\x7E", 'GB18030') #
check_both_ways("\u4E90", "\x81\x80", 'GB18030') #
@ -1691,7 +1697,7 @@ class TestTranscode < Test::Unit::TestCase
check_both_ways("\u9752\u5C71\u5B66\u9662\u5927\u5B66", "\xC7\xE0\xC9\xBD\xD1\xA7\xD4\xBA\xB4\xF3\xD1\xA7", 'GB18030') # 青山学院大学
check_both_ways("\u795E\u6797\u7FA9\u535A", "\xC9\xF1\xC1\xD6\xC1\x78\xB2\xA9", 'GB18030') # 神林義
# new tests for GB18030
# new tests for GB18030
check_both_ways("\u9FA6", "\x82\x35\x8F\x33", 'GB18030') # 龦
check_both_ways("\uD7FF", "\x83\x36\xC7\x38", 'GB18030') # No name ()