Skip to content

[pkg/ottl] Fix Substring function corrupting multibyte UTF-8 strings#48867

Closed
Vanshul97 wants to merge 1 commit into
open-telemetry:mainfrom
Vanshul97:fix/ottl-substring-utf8
Closed

[pkg/ottl] Fix Substring function corrupting multibyte UTF-8 strings#48867
Vanshul97 wants to merge 1 commit into
open-telemetry:mainfrom
Vanshul97:fix/ottl-substring-utf8

Conversation

@Vanshul97

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
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.

@edmocosta edmocosta closed this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pkg/ottl] The Substring function corrupts multibyte UTF-8 strings (byte based slicing)

3 participants