alhudz opened a new pull request, #1724:
URL: https://github.com/apache/commons-lang/pull/1724

   Repro: `StringUtils.isAlpha(new String(Character.toChars(0x10400)))` 
(`DESERET CAPITAL LETTER LONG I`, a letter) returns `false`, and 
`StringUtils.isNumeric(new String(Character.toChars(0x1D7CE)))` (`MATHEMATICAL 
BOLD DIGIT ZERO`, a digit) returns `false`.
   
   Cause: the `is*` predicates (`isAlpha`, `isAlphaSpace`, `isAlphanumeric`, 
`isAlphanumericSpace`, `isNumeric`, `isNumericSpace`, `isAllLowerCase`, 
`isAllUpperCase`, `isMixedCase`) walk the input one `char` at a time and hand 
each `char` to 
`Character.isLetter`/`isDigit`/`isLetterOrDigit`/`isUpperCase`/`isLowerCase`. A 
supplementary code point is two surrogate chars, neither of which is a letter, 
digit or cased char on its own, so a supplementary letter or digit is rejected 
even though the Javadoc tests for Unicode letters/digits.
   
   Fix: iterate with `Character.codePointAt` and advance by 
`Character.charCount`, classifying the whole code point at each site. BMP input 
keeps the same result (a lone surrogate still classifies as before).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to