Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Bug: file-read tool decodes UTF-8 files as CP1251 (Windows), and edits round-trip lossily
Environment: Cursor on Windows 10 (win32 10.0.19045), PowerShell shell, repo with UTF-8 files
containing em dashes and Cyrillic text.
What happens
The agent’s file-read tool mis-decodes UTF-8 file content as CP1251 (Windows-1251). Every
non-ASCII character reaches the model as mojibake:
—(U+2014, UTF-8E2 80 94) is presented as—Заголовокis presented asЗаголовок
The same wrong decoding appears in the search tool’s content output and in the terminal-output
files the agent reads. Notably, the shell’s own stdout decodes correctly — git log printed
the same em dashes properly in the same session — so it is specific to the file-read path.
Why it’s harmful
- The model cannot see the real content, and it quotes the mojibake back to the user, which
looks like the model corrupted something. - The write path is lossy. Because the model is shown
—, it reproduces—in an edit’s
replacement text; what actually lands on disk is a plain ASCII-. So an edit silently
downgrades characters it never intended to touch, and the file ends up with inconsistent
punctuation. Exact-match replacement of untouched text does round-trip, which makes the
damage easy to miss. - There is no workaround at the tool level: the read tool takes only
path/offset/
limit, with no encoding parameter. The only escape is reading files through the shell
(Get-Content -Encoding UTF8), which the tool guidance explicitly discourages.
Steps to Reproduce
Repro
- On a Windows machine whose system ANSI codepage is 1251, create a UTF-8 file containing
a — b. - Ask the agent to read it: it reports
a вЂ" b. - Ask the agent to edit that line: the written result contains
a - b.
Expected Behavior
Expected
Decode file bytes as UTF-8 (with BOM detection and a sane fallback), independent of the Windows
system ANSI codepage, and encode edits back as UTF-8. Optionally expose an encoding override.
Operating System
Windows 10/11
Version Information
3.14.27 (user setup)
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor