[pkg/ottl] Fix Substring function corrupting multibyte UTF-8 strings#48867
Closed
Vanshul97 wants to merge 1 commit into
Closed
[pkg/ottl] Fix Substring function corrupting multibyte UTF-8 strings#48867Vanshul97 wants to merge 1 commit into
Vanshul97 wants to merge 1 commit into
Conversation
The Substring function used byte-based slicing (val[start:start+length]) which corrupts multibyte UTF-8 characters like CJK or emoji. Changed to rune-based slicing so start and length refer to character positions. Fixes open-telemetry#48436
Contributor
|
Thanks for the PR @Vanshul97! Another contributor is already wrapping up a fix for this issue in #48590. I will close this PR to avoid duplicate work, but we appreciate your time and effort. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes byte-based slicing in Substring that corrupts CJK/emoji characters. Uses rune-based slicing so start/length refer to character positions. Added tests for Japanese and emoji strings. Fixes #48436