The AI assistant's file editing tool (search_replace) cannot preserve the original encoding (GBK/GB2312) when editing files, causing Chinese characters to become garbled

Hey, thanks for the report. This is a known issue: Agent in 2.4.x forces all files to be saved as UTF-8, ignoring the original encoding.

Similar reports with GBK, EUC-KR, Windows-1252:

Workarounds:

  1. Roll back to 2.3.41. A few users confirmed this fully fixes the issue.
  2. After Agent edits: bottom-right corner of the editor → click the encoding → “Reopen with Encoding” → GBK, then “Save with Encoding” → GBK.
  3. Try CTRL+K (inline edit) instead of Agent/Chat. It might break encoding less, but it’s not guaranteed.

The team is aware of the issue. Your report helps raise the priority, especially for GBK/GB2312, which are critical for Chinese legacy projects.