The search_replace tool corrupts special characters (á, é, í, ó, ú, ñ) in Delphi .pas files encoded as ANSI/Windows-1252, even when modifying small sections of code.
Steps to Reproduce
Open a Delphi .pas file with ANSI/Windows-1252 encoding containing Spanish characters
Use search_replace to modify any section of the file
Special characters get corrupted (e.g., ‘á’ becomes ‘á’, then ‘úscula’)
Expected Behavior
The tool should preserve the original file encoding and not corrupt existing special characters.
Actual Behavior:
Special characters are corrupted even in lines that were not directly targeted for modification, but were part of a larger context block.
Operating System
Windows 10/11
Current Cursor Version (Menu → About Cursor → Copy)
Hey, thanks for the report. This is a known issue. The agent currently always saves files as UTF-8, even if a different encoding is set in the workspace.
Temporary workaround:
After the agent edits a file, manually re-save it as Windows-1252 (bottom-right corner of the editor, click the encoding, then “Save with Encoding”, then Windows-1252)
Or try using CTRL+K for inline edits instead of the agent. It may mess up the encoding less, but it’s not guaranteed
Can you share the Request ID from the most recent broken generation? Click the three dots in the top-right of the chat, then Copy Request ID. I’ll link your report to our internal ticket to raise the priority of the fix for Delphi and ANSI files.