mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-20 20:19:32 +00:00
ICU-7273 fix new FC_NFKC_Closure implementation
X-SVN-Rev: 27533
This commit is contained in:
parent
bf11f11afa
commit
537b4141fa
3 changed files with 6 additions and 6 deletions
|
@ -134,7 +134,7 @@ public final class Norm2AllModes {
|
|||
return 1;
|
||||
}
|
||||
|
||||
Normalizer2Impl impl;
|
||||
public final Normalizer2Impl impl;
|
||||
}
|
||||
|
||||
public static final class DecomposeNormalizer2 extends Normalizer2WithImpl {
|
||||
|
|
|
@ -1279,7 +1279,6 @@ public final class Normalizer implements Cloneable {
|
|||
// (What could be useful is a custom normalization table that combines
|
||||
// case folding and NFKC.)
|
||||
// For the derivation, see Unicode's DerivedNormalizationProps.txt.
|
||||
Normalizer2Impl nfkcImpl=Norm2AllModes.getNFKCInstanceNoIOException().impl;
|
||||
UCaseProps csp;
|
||||
try {
|
||||
csp=UCaseProps.getSingleton();
|
||||
|
@ -1288,19 +1287,19 @@ public final class Normalizer implements Cloneable {
|
|||
}
|
||||
// first: b = NFKC(Fold(a))
|
||||
StringBuffer folded=new StringBuffer();
|
||||
String kc1;
|
||||
int folded1Length=csp.toFullFolding(c, folded, 0);
|
||||
if(folded1Length<0) {
|
||||
kc1=nfkcImpl.getDecomposition(c);
|
||||
if(kc1==null) {
|
||||
Normalizer2Impl nfkcImpl=((Norm2AllModes.Normalizer2WithImpl)NFKC.normalizer2).impl;
|
||||
if(nfkcImpl.getCompQuickCheck(nfkcImpl.getNorm16(c))!=0) {
|
||||
return ""; // c does not change at all under CaseFolding+NFKC
|
||||
}
|
||||
folded.appendCodePoint(c);
|
||||
} else {
|
||||
if(folded1Length>UCaseProps.MAX_STRING_LENGTH) {
|
||||
folded.appendCodePoint(folded1Length);
|
||||
}
|
||||
kc1=NFKC.normalizer2.normalize(folded);
|
||||
}
|
||||
String kc1=NFKC.normalizer2.normalize(folded);
|
||||
// second: c = NFKC(Fold(b))
|
||||
String kc2=NFKC.normalizer2.normalize(UCharacter.foldCase(kc1, 0));
|
||||
// if (c != b) add the mapping from a to c
|
||||
|
|
|
@ -2208,6 +2208,7 @@ public class BasicTest extends TestFmwk {
|
|||
|
||||
TestStruct[] tests= new TestStruct[]{
|
||||
new TestStruct( 0x00C4, "" ),
|
||||
new TestStruct( 0x00E4, "" ),
|
||||
new TestStruct( 0x037A, "\u0020\u03B9" ),
|
||||
new TestStruct( 0x03D2, "\u03C5" ),
|
||||
new TestStruct( 0x20A8, "\u0072\u0073" ) ,
|
||||
|
|
Loading…
Add table
Reference in a new issue