From 76c3098a5a06a9549815fe01d419db61c85c01a4 Mon Sep 17 00:00:00 2001 From: duerst Date: Tue, 29 Mar 2016 07:53:43 +0000 Subject: * enc/unicode/case-folding.rb, casefold.h: Tweaked handling of 6 special cases in CaseUnfold_11_Table. * enc/unicode.c: Adjustments for above. * test/ruby/enc/test_case_mapping.rb: Tests for the above: Some tests in test_titlecase activated; test_greek added. A test in test_cherokee fixed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enc/unicode.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'enc/unicode.c') diff --git a/enc/unicode.c b/enc/unicode.c index 87ebb0d8a8..eebf060dd9 100644 --- a/enc/unicode.c +++ b/enc/unicode.c @@ -750,12 +750,17 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP, } } else if ((folded = onigenc_unicode_unfold1_lookup(code)) != 0) { /* data about character found in CaseUnfold_11_Table */ - if (flags&OnigCaseFoldFlags(folded->n)) { - int count = OnigCodePointCount(folded->n); - const OnigCodePoint *next = folded->code; + if (flags&OnigCaseFoldFlags(folded->n)) { /* needs and data availability match */ MODIFIED; - if (count==1) - code = *next; + if (flags&OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) + code = folded->code[1]; + else + code = folded->code[0]; + } + else if ((flags&(ONIGENC_CASE_UPCASE)) + && (code==0x03B9||code==0x03BC)) { /* GREEK SMALL LETTERs IOTA/MU */ + MODIFIED; + code = folded->code[1]; } } } -- cgit v1.2.3