ICU-2920 isRuleWhiteSpace changed to remove most Cf characters

X-SVN-Rev: 12639
This commit is contained in:
Syn Wee Quek 2003-07-17 21:13:24 +00:00
parent e3490ec6ab
commit f2508fe78f
2 changed files with 28 additions and 7 deletions

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/lang/UCharacterTest.java,v $
* $Date: 2003/06/09 23:31:10 $
* $Revision: 1.59 $
* $Date: 2003/07/17 21:13:24 $
* $Revision: 1.60 $
*
*******************************************************************************
*/
@ -29,6 +29,7 @@ import com.ibm.icu.impl.UCharacterName;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.impl.USerializedSet;
import com.ibm.icu.impl.NormalizerImpl;
import com.ibm.icu.impl.UCharacterProperty;
import java.io.BufferedReader;
import java.util.Arrays;
@ -182,6 +183,25 @@ public final class UCharacterTest extends TestFmwk
hex(nonspaces[i]) + " and \\u" + hex(whitespaces[i]) +
" and \\u" + hex(nonwhitespaces[i]));
}
int rulewhitespace[] = {0x9, 0xd, 0x20, 0x85, 0xa0, 0x1680, 0x180e,
0x2000, 0x200a, 0x200e, 0x200f, 0x2028, 0x2029,
0x202f, 0x205f, 0x3000};
int nonrulewhitespace[] = {0x8, 0xe, 0x21, 0x86, 0xa1, 0x1681, 0x180f,
0x1FFF, 0x200b, 0x2010, 0x2030, 0x2030,
0x2060, 0x3001};
for (int i = 0; i < rulewhitespace.length; i ++) {
if (!UCharacterProperty.isRuleWhiteSpace(rulewhitespace[i])) {
errln("\\u" + Utility.hex(rulewhitespace[i], 4)
+ " expected to be a rule white space");
}
}
for (int i = 0; i < nonrulewhitespace.length; i ++) {
if (UCharacterProperty.isRuleWhiteSpace(nonrulewhitespace[i])) {
errln("\\u" + Utility.hex(nonrulewhitespace[i], 4)
+ " expected to be a non rule white space");
}
}
}
/**

View file

@ -6,8 +6,8 @@
*
* $Source:
* /usr/cvs/icu4j/icu4j/src/com/ibm/icu/text/UCharacterPropertyDB.java $
* $Date: 2003/06/09 23:15:00 $
* $Revision: 1.31 $
* $Date: 2003/07/17 21:13:23 $
* $Revision: 1.32 $
*
*******************************************************************************
*/
@ -1211,9 +1211,8 @@ public final class UCharacterProperty implements Trie.DataManipulate
{
// "white space" in the sense of ICU rule parsers: Cf+White_Space
UCharacterProperty property = UCharacterProperty.getInstance();
return (property.getProperty(c) & TYPE_MASK)
== UCharacterCategory.FORMAT
|| property.hasBinaryProperty(c, UProperty.WHITE_SPACE);
return property.hasBinaryProperty(c, UProperty.WHITE_SPACE)
|| c == LEFT_RIGHT_MARK_ || c == RIGHT_LEFT_MARK_;
}
/**
@ -1992,6 +1991,8 @@ public final class UCharacterProperty implements Trie.DataManipulate
private static final int FIGURESP= 0x2007;
private static final int HAIRSP = 0x200a;
private static final int ZWNJ = 0x200c;
private static final int LEFT_RIGHT_MARK_ = 0x200E;
private static final int RIGHT_LEFT_MARK_ = 0x200F;
private static final int ZWJ = 0x200d;
private static final int RLM = 0x200f;
private static final int NNBSP = 0x202f;