Unicode characters

1 отговора 136 прегледа
#1

Unicode characters

Our code is using the Character.isIdentifierIgnorable(char) to filter the string for invalid characters. We are having a problem with some Unicode characters returning true, specifically with some Cyrillic characters. These characters end up getting dropped or corrupted. Has anyone else had a similar problem. Would adding an additional conditions of !Character.isUnicodeIdentifierStart() and Character.isUnicodeIdentifierPart().



example:

if ( Character.isIdentifierIgnorable(char) && Character.isUnicodeIdentifierPart(char) && !Character.isUnicodeIdentifierStart(char) ) {

<throw out character>

}

else {

<keep character>

}



Our current JDK is Solaris_JDK_1.2.2_07. There is a possibility of using JDK 1.3.1. JDK 1.4 and 1.5 are not available in our current environment.

Отговор
в отговор на Mariana #2

Re: Unicode characters

Mariana, it is more likely to get solution if you describe what are you willing to acheive. I can't imagine what would you need this condition for:
!Character.isUnicodeIdentifierStart() && Character.isUnicodeIdentifierPart()

...IdentfierStart characters are a subset of ...IdentifierPart characters, so this part of the condition effectively subtracts these two sets. Could you explain what good will do that, and what is the final goal?

Отговор