Edit tool silently substitutes Unicode smart quotes for ASCII double quotes in shell scripts

Resolved 💬 5 comments Opened May 29, 2026 by IsaacGemal Closed Jul 3, 2026

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

  1. Ask Claude Code to add a shell function to ~/.zshrc containing double-quoted strings
  2. Source the file and run the function
  3. 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.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗