There is an even more serious issue: Cursor frequently corrupts the encoding of my C++ files, severely disrupting my workflow. Sometimes, the encoding gets corrupted even in files I haven’t actually modified or edited. I use UTF-8 with BOM; logically, the editor should preserve the source file’s existing encoding rather than altering it while I work. This happens at least a dozen times a day.
Hi there!
We detected that this may be a bug report, so we’ve moved your post to the Bug Reports category.
To help us investigate and fix this faster, could you edit your original post to include the details from the template below?
Bug Report Template - Click to expand
Where does the bug appear (feature/product)?
- Editor, Tab & Chat (autocomplete, Composer, in-editor agent)
- Terminal & commands
- Models, pricing & API keys (availability, Auto/Max, BYOK/Bedrock)
- MCP & tools
- Cloud Agents & Automations (Signing in to Cursor, scheduled/event)
- BugBot & Code Review
- Cursor CLI
- Cursor Mobile
- Remote (SSH / Dev Containers / WSL)
- Account, billing & login
- Something else…
Describe the Bug
A clear and concise description of what the bug is.
Steps to Reproduce
How can you reproduce this bug? We have a much better chance at fixing issues if we can reproduce them!
- …
- …
- …
Expected Behavior
What is meant to happen here that isn’t working correctly?
Screenshots / Screen Recordings
If applicable, attach images or videos (.jpg, .png, .gif, .mp4, .mov)
Operating System
- Windows 10/11
- MacOS
- Linux
Version Information
- For Cursor IDE: Menu → About Cursor → Copy
- For Cursor CLI: Run
agent aboutin your terminal
IDE:
Version: 2.xx.x
VSCode Version: 1.105.1
Commit: ......
CLI:
CLI Version 2026.01.17-d239e66
For AI issues: which model did you use?
Model name (e.g., Sonnet 4, Tab…)
For AI issues: add Request ID with privacy disabled
Request ID: f9a7046a-279b-47e5-ab48-6e8dc12daba1
For Background Agent issues, also post the ID: bc-…
Additional Information
Add any other context about the problem here.
Does this stop you from using Cursor?
- Yes - Cursor is unusable
- Sometimes - I can sometimes use Cursor
- No - Cursor works, but with this issue
The more details you provide, the easier it is for us to reproduce and fix the issue. Thanks!
Hey, thanks for the detailed report. Encoding getting corrupted during agent edits is an issue we’re tracking, especially with UTF-8 with BOM and non-ASCII files like Chinese, GBK, etc. I’ve passed your case to the team. I can’t share an ETA yet.
On the source code question, just to close the loop. This isn’t an export and it isn’t code theft. Agent edits are a local write to files on your machine, not an upload of your sources anywhere. You also have Privacy Mode enabled, so your code isn’t stored on our side. What you’re seeing is an issue with how edit picks an encoding when writing, not files being sent out.
A workaround that should help in your case since all files are UTF-8 with BOM. Open Ctrl+Shift+P > Preferences: Open User Settings (JSON) and add:
"files.encoding": "utf8bom",
"files.autoGuessEncoding": false
Then restart Cursor. This should make edits keep BOM and UTF-8 instead of switching to GBK or the local code page.
If it still happens after that, can you help narrow it down by sharing a couple things:
- Your OS and Cursor version via Help > About.
- What
files.encodingwas set to before the change. - A quick test: open a
.cppwith Chinese comments, confirm the status bar at the bottom right says UTF-8 with BOM, close the tab, in a new chat ask the agent to change one line using the edit tool with no terminal, then reopen the file and check the status bar encoding and the first line. - What the corruption looks like exactly, like BOM missing,
锘?at the start, Chinese turned into?, or random garbage.
Also about files you didn’t edit. Check the chat history and see if there was any shell command like PowerShell Set-Content, Out-File, or > that wrote to those files. On Windows those commands can save as ANSI, GBK, or UTF-16 by default, and that’s a different path than the edit tool. If you find something like that, send it over since it helps figure out what’s actually corrupting those files.
For recovery. If files are already broken, check git or Local History via Ctrl+Shift+P > Local History and roll back to a version before the issue.
Let me know how it goes after changing the settings.