[PR #1469] [MERGED] fix(editor): handle UTF-8 characters properly in SetValueWithAttachments #9943

Closed
opened 2026-02-16 18:14:25 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1469
Author: @neolooong
Created: 7/31/2025
Status: Merged
Merged: 7/31/2025
Merged by: @adamdotdevin

Base: devHead: fix/set-value-with-attachments


📝 Commits (1)

  • 5acd1ad fix(editor): handle UTF-8 characters properly in SetValueWithAttachments

📊 Changes

1 file changed (+12 additions, -7 deletions)

View changed files

📝 packages/tui/internal/components/chat/editor.go (+12 -7)

📄 Description

Problem

Content returned from $EDITOR displays strange characters if it is multi-byte UTF-8 character.

The SetValueWithAttachments function was using byte-based string indexing which causes issues.


Before:

https://github.com/user-attachments/assets/ead9aa08-53e1-469e-abed-f80d5ddcd189

After:

https://github.com/user-attachments/assets/eac0e121-1bf6-4a2c-9236-5091ce678634


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1469 **Author:** [@neolooong](https://github.com/neolooong) **Created:** 7/31/2025 **Status:** ✅ Merged **Merged:** 7/31/2025 **Merged by:** [@adamdotdevin](https://github.com/adamdotdevin) **Base:** `dev` ← **Head:** `fix/set-value-with-attachments` --- ### 📝 Commits (1) - [`5acd1ad`](https://github.com/anomalyco/opencode/commit/5acd1adb61f823d2efd2dab2982f533d7d4527dc) fix(editor): handle UTF-8 characters properly in SetValueWithAttachments ### 📊 Changes **1 file changed** (+12 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/tui/internal/components/chat/editor.go` (+12 -7) </details> ### 📄 Description ## Problem Content returned from `$EDITOR` displays strange characters if it is multi-byte UTF-8 character. The `SetValueWithAttachments` function was using byte-based string indexing which causes issues. --- Before: https://github.com/user-attachments/assets/ead9aa08-53e1-469e-abed-f80d5ddcd189 After: https://github.com/user-attachments/assets/eac0e121-1bf6-4a2c-9236-5091ce678634 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:25 -05:00
yindo closed this issue 2026-02-16 18:14:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9943