You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "alhudz (via GitHub)" <gi...@apache.org> on 2026/06/25 12:52:56 UTC

[PR] keep WordUtils.wrap from splitting a surrogate pair [commons-lang]

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

   Repro: `WordUtils.wrap("a😀😀😀😀", 4, "\n", true)`, four `U+1F600` after a leading `a`.
   Cause: with `wrapLongWords` set, a word longer than the column is hard-broken at the fixed char offset `wrapLength + offset` and the new-line is inserted there. When that offset lands between the high and low surrogate of a supplementary code point the pair is split, so a lossless wrap emits a lone high surrogate at the end of one line and a lone low surrogate at the start of the next.
   Fix: nudge the break one char forward when it would land inside a pair, keeping the whole code point on the current line. BMP input and the delimiter-based wrap paths are unaffected.


-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Keep WordUtils.wrap from splitting a surrogate pair [commons-lang]

Posted by "alhudz (via GitHub)" <gi...@apache.org>.
alhudz commented on PR #1731:
URL: https://github.com/apache/commons-lang/pull/1731#issuecomment-4807590022

   Ported in apache/commons-text#755 - same fix, the wrap test fails on the current Text tree without it.


-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Keep WordUtils.wrap from splitting a surrogate pair [commons-lang]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #1731:
URL: https://github.com/apache/commons-lang/pull/1731#issuecomment-4803377452

   Merged, TY @alhudz, please port to Apache Commons Text.


-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Keep WordUtils.wrap from splitting a surrogate pair [commons-lang]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #1731:
URL: https://github.com/apache/commons-lang/pull/1731


-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org