StrReplace tool doesn't explicitly handle UTF-8 encoding

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

When having the agent create spanish strings any character with accents are written instead with a ?. When I pushed the agent why it was not writing the accented characters it responded with: The issue is that the StrReplace tool doesn’t explicitly handle UTF-8 encoding. It switched to sed to perform the edit, but it would be nice if the file tools could handle unicode characters.
When you look at the charset of the file edited or created it shows as us-ascii

Steps to Reproduce

Ask the agent to “Create a file with random spanish words that have characters with accents”
Execute the shell command “file -I filecreated.txt”

Expected Behavior

File should be written with charset utf-8 or utf-16 to support unicode characters.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2025.10.28-0a91dc2

For AI issues: which model did you use?

Any model

For AI issues: add Request ID with privacy disabled

Request ID: 6dcfdbd6-8db6-43fd-a0ed-c82ae610521f

Does this stop you from using Cursor

No - Cursor works, but with this issue

3 Likes

Hey, thanks for the report. This is a clear issue: the CLI agent’s StrReplace tool isn’t handling UTF-8 correctly.

I’ll pass this to the team. The fact that the agent detects the limitation and switches to sed is helpful context.

As a temporary workaround, you can keep letting the agent use sed for edits, or manually specify UTF-8 after creating the file.

1 Like

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

I requested the Cursor agent to write a PR description based on a template. The agent generated the PR description and updated it to the PR, but the result wasn’t correct — the emoji was replaced with question marks (??).

- [ ] ?? Bug fix (non-breaking change which fixes an issue)
- [x] ? New feature (non-breaking change which adds functionality)
- [ ] ?? Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] ?? Documentation update
- [x] ?? Refactoring (no functional changes)
- [ ] ?? Style/formatting changes
- [ ] ?? Test improvements
- [ ] ?? Configuration changes

Steps to Reproduce

  1. request cursor agent to write PR description
  2. cursor agent read the template
  3. generate PR description and update it to the PR

Expected Behavior

Generate PR description with correct emoji.

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] 📚 Documentation update
- [ ] ♻️ Refactoring (no functional changes)
- [ ] 🎨 Style/formatting changes
- [ ] 🧪 Test improvements
- [ ] 🔧 Configuration changes

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

$ cursor-agent --version   
2025.10.28-0a91dc2

Does this stop you from using Cursor

No - Cursor works, but with this issue