Skip to content

Commit f917158

Browse files
committed
ICU-11574 fix Cherokee case folding data: add scf->self mappings for characters that do not have sfc (map to self) but have slc (ICU code: sfc falls back to slc)
X-SVN-Rev: 37374
1 parent 928da72 commit f917158

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

‎tools/unicode/c/genprops/casepropsbuilder.cpp‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
*******************************************************************************
33
*
4-
* Copyright (C) 2004-2012, International Business Machines
4+
* Copyright (C) 2004-2015, International Business Machines
55
* Corporation and others. All Rights Reserved.
66
*
77
*******************************************************************************
@@ -435,6 +435,20 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
435435
value|=UCASE_EXCEPTION;
436436
}
437437

438+
// Simple case folding falls back to simple lowercasing.
439+
// If there is no case folding but there is a lowercase mapping,
440+
// then add a case folding mapping to the code point.
441+
// For example: Cherokee uppercase syllables since Unicode 8.
442+
// (Full case folding falls back to simple case folding,
443+
// not to full lowercasing, so we need not also handle it specially
444+
// for such cases.)
445+
UChar32 scf=props.scf;
446+
if(scf<0 && props.slc>=0) {
447+
scf=start;
448+
hasMapping=TRUE;
449+
value|=UCASE_EXCEPTION;
450+
}
451+
438452
if(delta<UCASE_MIN_DELTA || UCASE_MAX_DELTA<delta) {
439453
value|=UCASE_EXCEPTION;
440454
}
@@ -485,6 +499,7 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
485499
errorCode=U_MEMORY_ALLOCATION_ERROR;
486500
return;
487501
}
502+
newExcProps->props.scf=scf;
488503
newExcProps->hasConditionalCaseMappings=newValues.contains(PPUCD_CONDITIONAL_CASE_MAPPINGS);
489504
newExcProps->hasTurkicCaseFolding=newValues.contains(PPUCD_TURKIC_CASE_FOLDING);
490505
value|=(uint32_t)excPropsCount<<UGENCASE_EXC_SHIFT;
@@ -504,7 +519,7 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
504519
if(hasMapping) {
505520
/* update the case-sensitive set */
506521
caseSensitive.add(start);
507-
if(props.scf>=0) { caseSensitive.add(props.scf); }
522+
if(scf>=0) { caseSensitive.add(scf); }
508523
if(props.slc>=0) { caseSensitive.add(props.slc); }
509524
if(props.suc>=0) { caseSensitive.add(props.suc); }
510525
if(props.stc>=0) { caseSensitive.add(props.stc); }
@@ -907,10 +922,9 @@ CasePropsBuilder::makeException(UChar32 c, uint32_t value, ExcProps &ep, UErrorC
907922
excWord|=U_MASK(UCASE_EXC_LOWER);
908923
}
909924
if( p.scf>=0 &&
910-
(p.slc>=0 ?
911-
p.slc!=p.slc :
912-
p.slc!=c)
913-
) {
925+
(p.slc>=0 ?
926+
p.scf!=p.slc :
927+
p.scf!=c)) {
914928
slots[count]=(uint32_t)p.scf;
915929
slotBits|=slots[count];
916930
++count;

0 commit comments

Comments
 (0)