Why does Cursor sometimes convert Chinese text to question marks, and why does this issue persist in the same file once it occurs—every time I modify that file, the Chinese characters get turned into "?" again?

image

image

Hey there,

This is a known issue on our side, not anything wrong with your setup. When the agent edits a file, its write path can pick the wrong text encoding, and when that encoding can’t represent Chinese characters it swaps them for ?. The wrong encoding then gets “stuck” to that file, so the same thing happens on every later edit, which is why it keeps coming back in the same file. It’s something our team is tracking, though I don’t have a fix timeline to share yet.

Once characters have turned into a literal ?, they can’t be recovered from the file itself (the original characters are already gone). But the correct Chinese is still recoverable from before the edit:

  • If the change is still showing as a pending diff, reject it and the file stays intact.
  • If it’s already saved, restore the file from a Checkpoint taken before that edit, or from version control (e.g. git checkout -- <file>). Back up any other unsaved changes in that file first, since restoring overwrites the current version.

Reducing it going forward (most relevant on Windows, which the ? pattern points to):

  1. Enable the Windows UTF-8 locale: Control Panel > Region > Administrative > Change system locale, check “Beta: Use Unicode UTF-8 for worldwide language support”, then restart. This clears up most edits to existing files. (A few users on the very latest builds report it has become less reliable, so it may not be a complete fix.)
  2. Add a Cursor Rule that tells the agent to create new files through the terminal instead of the Write tool, e.g. “Always create new files using terminal commands, never the Write tool, to avoid encoding corruption.”
  3. The files.encoding setting on its own doesn’t reliably help here, because the agent’s write path uses its own encoding handling.

To point you at the right fix, could you share your OS and exact Cursor version (Help > About Cursor > Copy)? If edits to existing files keep corrupting even with the UTF-8 locale enabled, that’s a newer variant we’re actively looking into, and a sample of a corrupted file would help.