It changed the file encoding format, causing the text to become garbled

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In Cursor’s chat interface, the preview code displays Korean and Chinese characters correctly. However, when Cursor inserts the modified code into the actual file, it causes all Korean and Chinese characters in the entire file to become garbled. My project uses GBK encoding, and I have also set the Cursor IDE’s file encoding to GBK. I added a .vscode/settings.json file and even uninstalled all extensions, but the issue persists. Still no luck.

Steps to Reproduce

I created a Java project using GBK encoding and added comments in both Korean and Chinese to the code. Then, while chatting with Cursor, I asked it to help add code comments. After that, the issue I mentioned earlier occurred: the comment text displays correctly in the chat dialog, but once Cursor inserts the comments and code into the actual code file, all Korean and Chinese characters in the entire file become garbled.

Expected Behavior

It was supposed to use GBK encoding to modify and save the file, but it seems to have used another format—such as UTF-8, Windows-1255, or something else. I’m not entirely sure, because after applying the changes to the code file, everything just turned into question marks and random garbled characters.

Operating System

Windows 10/11

Version Information

Version: 2.4.21 (user setup)
VSCode Version: 1.105.1
Commit: dc8361355d709f306d5159635a677a571b277bc0
Date: 2026-01-22T16:57:59.675Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.19045

For AI issues: which model did you use?

Composer 1、Opus 4.5 、Sonnet 4.5 、GPT-5.2 Codex

For AI issues: add Request ID with privacy disabled

95c496de-ea41-4632-94cd-8e09b7c3b0f7

Does this stop you from using Cursor

No - Cursor works, but with this issue

I suspect this is a version-related issue. Before the update, I was using Cursor IDE version 2.3 without any problems, but after updating to the latest version, 2.4, this issue started occurring.

Hey, thanks for the report. This is a known issue. Agent always saves edited files as UTF-8 and ignores the original encoding.

Related threads: Encoding changing when editing EUC-KR files (EUC-KR), Cursor returns UTF-8 code despite Windows-1252 configuration (Windows-1252)

Temporary workaround:

  • After Agent edits: bottom-right corner of the editor → click the encoding → “Reopen with Encoding” → GBK
  • Then “Save with Encoding” → GBK
  • Or try CTRL+K (inline edit) instead of Agent/Chat. It might break the encoding less, but no guarantee

The team is aware. Your report helps raise the priority.

Same here. Since it seems the latest update is causing this, can I roll back to an older version for the time being?

Yes, absolutely. Reverting to version 2.3 fixed the issue.

2 Likes

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.