Skip to content

fix(stringutil): operate on runes instead of bytes in Truncate#22388

Merged
johnstcn merged 6 commits intomainfrom
cj/stringutil-fix
Feb 27, 2026
Merged

fix(stringutil): operate on runes instead of bytes in Truncate#22388
johnstcn merged 6 commits intomainfrom
cj/stringutil-fix

Conversation

@johnstcn
Copy link
Member

@johnstcn johnstcn commented Feb 27, 2026

Fixes #22375

Updates stringutil.Truncate to properly handle multi-byte UTF-8 characters.
Adds tests for multi-byte truncation with word boundary.

Created by Mux using Opus 4.6

@johnstcn johnstcn self-assigned this Feb 27, 2026
@johnstcn johnstcn requested a review from mafredri February 27, 2026 16:22
Replace byte-slicing capitalization (displayName[:1]) with a
capitalize() helper using utf8.DecodeRuneInString + unicode.ToUpper
in generateFromPrompt and generateFromAnthropic.
@johnstcn johnstcn enabled auto-merge (squash) February 27, 2026 17:43
@johnstcn johnstcn merged commit 0cfa037 into main Feb 27, 2026
25 checks passed
@johnstcn johnstcn deleted the cj/stringutil-fix branch February 27, 2026 17:46
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task creation fails with invalid UTF-8 from Truncate splitting multi-byte runes

2 participants