alhudz opened a new pull request, #1691:
URL: https://github.com/apache/commons-lang/pull/1691
Repro: build a `LookupTranslator` whose key is a single supplementary code
point, e.g. `U+1D54F` mapped to `X`, then `translate("𝕏Y")`.
Expected: `XY`. Actual: `X` — the trailing `Y` is silently dropped (likewise
`a𝕏b` becomes `aX`).
Cause: `translate` returns the matched key length counted in `char`s (`i`),
but `CharSequenceTranslator` documents the return value as a count of code
points and advances the cursor by `Character.charCount` per unit. A
supplementary key is two `char`s but one code point, so the loop steps twice
and over-consumes the following character.
Fix: return `Character.codePointCount(input, index, index + i)` so the count
matches the framework's code-point stepping. The other translators in the
package already return code-point counts, so this is the only affected site.
--
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]