1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
naruse 2015-10-04 07:25:56 +00:00
parent ec0793e437
commit 95d8076081
2 changed files with 6 additions and 4 deletions

View file

@ -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 */
}

View file

@ -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