claude-code - 💡(How to fix) Fix Edit tool silently substitutes Unicode smart quotes for ASCII double quotes in shell scripts

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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 ").

Root Cause

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 ").

Fix Action

Workaround

Rewrote the affected function using perl -i -0pe to guarantee plain ASCII bytes, bypassing the Edit tool entirely.

Code Example

touch: ""/tmp/yazi-cwd-4324"": No such file or directory
y:3: no such file or directory: """"
RAW_BUFFERClick to expand / collapse

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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Edit tool silently substitutes Unicode smart quotes for ASCII double quotes in shell scripts