When the Agent generates code changes, these changes appear in a review interface, with added and deleted content highlighted in different colored lines.This allows you to check and control which changes apply to your codebase.However, if the modified code uses GB2312 encoding, Chinese text may appear garbled. This issue occurs in version 2.4.
To help ensure most of our users can participate in discussions, this forum is currently English only.
If you’d like, you can edit your post to translate it into English. Once it meets our guidelines, it will be automatically relisted.
Thanks for understanding!
Note: This is an automated detection system and sometimes makes mistakes. If your post is already in English, feel free to ignore this message, or just make a small edit and it will be reviewed again.
Hey, thanks for the report. This is a known issue: when Agent edits files, it always saves them as UTF-8 and ignores the original encoding (GB2312/GBK in your case).
After Agent edits the file: 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 be less likely to break encoding, but it’s not guaranteed
About 2.3 vs 2.4: Yep, a few users confirmed the issue became more noticeable after updating to 2.4. You can roll back to 2.3 if the workaround doesn’t help.
The bug is logged. Your report helps raise the priority. Let me know if the workaround doesn’t work.
I’m experiencing the exact same issue described in this post. After updating Cursor last night, when I use Agent mode to edit ASP files encoded in GB2312/GBK, all Chinese characters become corrupted and are replaced with question marks (?).
Additional details:
This started happening immediately after updating Cursor last night
The file encoding corruption is permanent - even after using “Undo File” or “Reopen with Encoding”, the Chinese characters cannot be restored
The files are saved in UTF-8 after Agent edits, causing permanent corruption
I had been using Cursor successfully for months with GB2312 files without any issues before this update
My editor settings correctly specify "files.encoding": "gbk" for ASP files, but Agent mode seems to ignore this setting
Workaround:
Currently, I have to manually copy-paste code snippets from AI suggestions instead of letting Agent directly modify the files, which defeats the purpose of using Agent mode.
This is a critical issue for developers working with legacy Chinese codebases. I hope this can be fixed soon.
Yes, the corruption of code files by the Agent is permanent. Typically, the original Chinese characters are replaced with ASCII 0x3F (or the Unicode replacement character U+FFFD), and it is impossible to restore the original text from these substituted characters. My recommendation is to revert to version 2.3.41 or another 2.3 release. Currently, after rolling back to version 2.3.41, this issue has not recurred.