ICU-7272 fix implementation for script codes >0x7f

X-SVN-Rev: 26975
This commit is contained in:
Markus Scherer 2009-11-25 19:30:56 +00:00
parent 434ca552f8
commit fcb96edba1
3 changed files with 9 additions and 3 deletions

View file

@ -6371,7 +6371,7 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
* Integer properties mask and shift values for scripts.
* Equivalent to icu4c UPROPS_SHIFT_MASK
*/
private static final int SCRIPT_MASK_ = 0x000000ff;
static final int SCRIPT_MASK_ = 0x000000ff;
// private constructor -----------------------------------------------
///CLOVER:OFF

View file

@ -747,7 +747,6 @@ public final class UScript {
*/
public static final int CODE_LIMIT = 134;
private static final int SCRIPT_MASK = 0x0000007f;
private static final UCharacterProperty prop= UCharacterProperty.getInstance();
private static final String kLocaleScript = "LocaleScript";
@ -873,7 +872,7 @@ public final class UScript {
*/
public static final int getScript(int codepoint){
if (codepoint >= UCharacter.MIN_VALUE & codepoint <= UCharacter.MAX_VALUE) {
return (prop.getAdditional(codepoint,0) & SCRIPT_MASK);
return (prop.getAdditional(codepoint,0) & UCharacter.SCRIPT_MASK_);
}else{
throw new IllegalArgumentException(Integer.toString(codepoint));
}

View file

@ -1894,6 +1894,13 @@ public final class UCharacterTest extends TestFmwk
{ 0xff63, UProperty.SENTENCE_BREAK, UCharacter.SentenceBreak.CLOSE },
{ 0x2028, UProperty.SENTENCE_BREAK, UCharacter.SentenceBreak.SEP },
{ -1, 0x520, 0 }, /* version break for Unicode 5.2 */
/* test some script codes >127 */
{ 0xa6e6, UProperty.SCRIPT, UScript.BAMUM },
{ 0xa4d0, UProperty.SCRIPT, UScript.LISU },
{ 0x10a7f, UProperty.SCRIPT, UScript.OLD_SOUTH_ARABIAN },
/* undefined UProperty values */
{ 0x61, 0x4a7, 0 },
{ 0x234bc, 0x15ed, 0 }