Edit tool silently substitutes Unicode smart quotes for ASCII double quotes in shell scripts
Summary
When using the Edit tool to write shell script content (e.g. a zsh function in ~/.zshrc), the tool silently substituted Unicode "smart quotes" (U+201C " and U+201D ") in place of plain ASCII double quotes (U+0022 ").
Impact
The resulting file looks correct visually in most editors/fonts, but the shell treats the smart quotes as literal string content rather than delimiters. This caused runtime errors like:
touch: ""/tmp/yazi-cwd-4324"": No such file or directory
y:3: no such file or directory: """"
The embedded quote characters were showing up inside variable values (e.g. tmp contained "/tmp/yazi-cwd-4324" instead of /tmp/yazi-cwd-4324).
Steps to Reproduce
- Ask Claude Code to add a shell function to
~/.zshrccontaining double-quoted strings - Source the file and run the function
- Observe runtime errors due to smart quotes embedded in variable values
Verification
The corruption was confirmed via hexdump -C, which showed e2 80 9c / e2 80 9d (UTF-8 encoding of U+201C/U+201D) where 22 (ASCII double quote) was expected.
Workaround
Rewrote the affected function using perl -i -0pe to guarantee plain ASCII bytes, bypassing the Edit tool entirely.
Expected Behavior
The Edit tool should preserve ASCII double quotes (U+0022) exactly as written, with no smart-quote substitution.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗