ruby-changes:53754
From: duerst <ko1@a...>
Date: Sun, 25 Nov 2018 19:12:49 +0900 (JST)
Subject: [ruby-changes:53754] duerst:r65971 (trunk): deal with ONIGENC_CASE_IS_TITLECASE flag on lowercase characters
duerst 2018-11-25 19:12:45 +0900 (Sun, 25 Nov 2018) New Revision: 65971 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65971 Log: deal with ONIGENC_CASE_IS_TITLECASE flag on lowercase characters In the function onigenc_unicode_case_map() in enc/unicode.c, deal with the case that the ONIGENC_CASE_IS_TITLECASE flag is set on lowercase characters. This is in preparation for Georgian Mtavruli, which are uppercase but not titlecase, in Unicode 11.0.0. Modified files: trunk/enc/unicode.c Index: enc/unicode.c =================================================================== --- enc/unicode.c (revision 65970) +++ enc/unicode.c (revision 65971) @@ -772,10 +772,15 @@ SpecialsCopy: https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L772 } } } - else if ((folded = onigenc_unicode_unfold1_lookup(code)) != 0 /* data about character found in CaseUnfold_11_Table */ - && flags & OnigCaseFoldFlags(folded->n)) { /* needs and data availability match */ - MODIFIED; - code = folded->code[(flags & OnigCaseFoldFlags(folded->n) & ONIGENC_CASE_TITLECASE) ? 1 : 0]; + else if ((folded = onigenc_unicode_unfold1_lookup(code)) != 0) { /* data about character found in CaseUnfold_11_Table */ + if ((flags & ONIGENC_CASE_TITLECASE) /* Titlecase needed, */ + && (OnigCaseFoldFlags(folded->n) & ONIGENC_CASE_IS_TITLECASE)) { /* but already Titlecase */ + /* already Titlecase, no changes needed */ + } + else if (flags & OnigCaseFoldFlags(folded->n)) { /* needs and data availability match */ + MODIFIED; + code = folded->code[(flags & OnigCaseFoldFlags(folded->n) & ONIGENC_CASE_TITLECASE) ? 1 : 0]; + } } } to += ONIGENC_CODE_TO_MBC(enc, code, to); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/