diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-04 07:25:56 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-04 07:25:56 +0000 |
commit | 95d80760818e23316f7789fdaa0caa2d61eb6227 (patch) | |
tree | 6cf91b60939da26ebd3df9f71310f913ab99538b | |
parent | ec0793e437e4ea9f6a49d72ed08f039f3e59ff9a (diff) | |
download | ruby-95d80760818e23316f7789fdaa0caa2d61eb6227.tar.gz |
refix through 52016,52017,52019,52020 [Bug #11486]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | enc/euc_jp.c | 7 | ||||
-rw-r--r-- | test/ruby/test_m17n_comb.rb | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/enc/euc_jp.c b/enc/euc_jp.c index 4121750b8d..7922aac150 100644 --- a/enc/euc_jp.c +++ b/enc/euc_jp.c @@ -378,12 +378,13 @@ mbc_case_fold(OnigCaseFoldType flag, return 1; } else { + OnigCodePoint code; int len; len = mbc_enc_len(p, end, enc); - if (len <= 0) return 1; - get_lower_case(mbc_to_code(p, end, enc)); - /* assuming case folding in euc-jp doesn't change length */ + code = get_lower_case(mbc_to_code(p, end, enc)); + len = code_to_mbc(code, lower, enc); + if (len == ONIGERR_INVALID_CODE_POINT_VALUE) len = 1; (*pp) += len; return len; /* return byte length of converted char to lower */ } diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb index c69133dd4d..83c3f8aa95 100644 --- a/test/ruby/test_m17n_comb.rb +++ b/test/ruby/test_m17n_comb.rb @@ -1637,6 +1637,7 @@ class TestM17NComb < Test::Unit::TestCase def test_bug11486 bug11486 = '[Bug #11486]' - assert_nil ("\u3042"*19+"\r"*19+"\u3042"*20+"\r"*20).encode("euc-jp").gsub!(/xxx/i, ""), bug11486 + assert_nil ("\u3042"*19+"\r"*19+"\u3042"*20+"\r"*20).encode(Encoding::EUC_JP).gsub!(/xxx/i, ""), bug11486 + assert_match Regexp.new("ABC\uff41".encode(Encoding::EUC_JP), Regexp::IGNORECASE), "abc\uFF21".encode(Encoding::EUC_JP), bug11486 end end |