You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "jokerzsd (via GitHub)" <gi...@apache.org> on 2026/09/11 10:08:22 UTC

[PR] fix(studio): preserve Unicode code points when truncating message properties [rocketmq-dashboard]

jokerzsd opened a new pull request, #4226:
URL: https://github.com/apache/rocketmq-dashboard/pull/4226

   ## Summary
   
   Fix message property values being truncated mid-surrogate-pair, producing unpaired surrogates.
   
   ## Problem
   
   `MessagePropertyDisplay.abbreviate` used UTF-16 `length()`/`substring(0, 1024)`. When the boundary fell between the high and low surrogate of a supplementary character (e.g. an emoji), the truncated value contained an unpaired surrogate and rendered as a replacement character.
   
   ## Fix
   
   Count code points (`codePointCount`) and truncate at a code-point boundary (`offsetByCodePoints`). `hasOversizedProperty` is updated to the same code-point semantics for consistency.
   
   ## Test plan
   
   Added a regression test (1023 ASCII chars + emoji straddling the boundary). `mvn test -Dtest=MessagePropertyDisplayTest` — 6 tests, 0 failures.
   
   Fixes #4167


-- 
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: commits-unsubscribe@rocketmq.apache.org

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


Re: [PR] fix(studio): preserve Unicode code points when truncating message properties [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #4226:
URL: https://github.com/apache/rocketmq-dashboard/pull/4226#issuecomment-5694502478

   Closing. The change pins `abbreviate`, but `hasOversizedProperty` in the same class still counts UTF-16 chars, so an oversized property value falls back to `value.length()` and can still be cut inside a surrogate pair; the javadoc also still documents a character cap.
   
   For context: #4170 covered both methods plus the javadoc and added a 1024-code-point boundary case, and its author closed it in favour of this PR. We are not taking either variant right now — a resubmission needs to cover `abbreviate`, `hasOversizedProperty` and the javadoc in one change.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

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


Re: [PR] fix(studio): preserve Unicode code points when truncating message properties [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #4226: fix(studio): preserve Unicode code points when truncating message properties
URL: https://github.com/apache/rocketmq-dashboard/pull/4226


-- 
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: commits-unsubscribe@rocketmq.apache.org

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