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

   Repro: `StringUtils.abbreviate("😀abcdef", 4)` returns a lone high surrogate 
followed by `...`, and `StringUtils.truncate("a😀b", 0, 2)` returns `a` plus a 
lone high surrogate.
   Cause: both choose the cut position in `char` units and slice with 
`String.substring`, so a boundary that lands between the two halves of a 
surrogate pair leaves an unpaired surrogate behind.
   Fix: nudge the boundary to the nearest code-point edge before slicing, so a 
pair is never split. The result still never exceeds `maxWidth`.


-- 
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