Encoding errors on new files

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When the agent creates a new file and writes accented text to it, encoding is not properly handled. This only happens when the agents create the new file. The new file encoding is utf-8.

Steps to Reproduce

Ask the agent to create a new text file and write a paragraph, in Portuguese, with some accents on it. The text generation seems to be correct, as displayed in the reasoning streamed text. However, when the agent finishes writing to the file, the accents on the saved file are corrupted.

Expected Behavior

Text should be written without encoding errors.

Operating System

Windows 10/11

Version Information

Version: 3.5.33 (user setup)
VSCode Version: 1.105.1
Commit: aac81804b986d739acab348ed96b8bea6e83cc50
Date: 2026-05-22T06:47:48.039Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26100

For AI issues: which model did you use?

All (the issue is not model specific)

For AI issues: add Request ID with privacy disabled

bb0409ec-75f6-419e-ab77-aa2425fe7608

Additional Information

The bug seems to be related to the tool the agent uses to write on the file. The file encoding is correct (UTF-8). This does not happens on latest 2.x version.

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey, thanks for the detailed report with the Request ID and the note about the 2.x regression. That really helps.

This is a known bug. When creating new files, the agent write tool sometimes detects the encoding from nearby files in the workspace and re-encodes UTF-8 content into Windows-1252, GBK, or another local encoding, which breaks multi-byte characters like Portuguese accents, CJK, and so on. It happens especially often on Windows. We’re tracking the issue, but I can’t share an ETA for a fix yet. Once we have an update, we’ll reply in the thread.

If you find a setup where the bug consistently doesn’t reproduce, like with a specific files.encoding setting or in an empty workspace, please let us know. That’s a useful signal.