[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XCBWRGG35WFSNWQVPKDF7H":3,"skill-same:01M6XCBWRGG35WFSNWQVPKDF7H":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":46,"linkOnly":47,"markdownContent":48,"markdownBody":49,"frontMatter":50,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":13,"repositoryHtmlUrl":54,"repositoryHomepageUrl":6,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M6XCBWRGG35WFSNWQVPKDF7H","unicode-safe-file-writing",null,"How to reliably write files containing multi-byte Unicode (emoji, special symbols) when write_file fails with 'unknown error' by falling back to run_shell with a heredoc.","UF-gzj\u002Fopenspace-claude-evolution","UF-gzj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272393507?v=4","01M6XBCZB755P01VVYGQWPYZY3","01M6XBCZFJA5AREA17WGETA3FW",0,"MIT","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Funicode-safe-file-writing\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000018","写作与文案","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],"safe","writing","file","unicode safe file writing","Unicode","when","unknown","with","multi","error","how to","emoji","back","files","write","how","shell","run","2026-11-10 10:12:30",false,"---\nname: unicode-safe-file-writing\ndescription: How to reliably write files containing multi-byte Unicode (emoji, special symbols) when write_file fails with 'unknown error' by falling back to run_shell with a heredoc.\n---\n\n# Unicode-Safe File Writing\n\n## Problem\n\nThe `write_file` tool may fail with `'unknown error'` when the file content\ncontains multi-byte Unicode characters such as:\n\n- Emoji (e.g. `?`, `✅`, `❌`)\n- Special typographic symbols (e.g. `→`, `•`, `—`, `©`)\n- Non-ASCII characters outside the Latin-1 range\n\nThis is a known encoding limitation of `write_file`.\n\n## Solution\n\nFall back to `run_shell` and write the file using a **shell heredoc**\n(`cat > file \u003C\u003C 'EOF' ... EOF`). The single-quoted delimiter `'EOF'`\nprevents the shell from interpreting any special characters inside the\nblock.\n\n---\n\n## Step-by-Step Recovery\n\n### Step 1 — Detect the failure\n\nIf `write_file` returns an error such as:\n\n```\nError: unknown error\n```\n\nand the content contains non-ASCII characters, assume a Unicode encoding\nissue and proceed to the heredoc fallback.\n\n### Step 2 — Strip or replace problematic characters (if needed)\n\nBefore embedding content in the heredoc, decide whether to:\n\n- **Keep** the characters as-is (works if the shell\u002Fterminal is UTF-8 aware)\n- **Replace** emoji\u002Fsymbols with ASCII equivalents (safest, most portable)\n- **Remove** them entirely\n\nCommon replacements:\n\n| Original | Replacement |\n|----------|-------------|\n| `✅`     | `[OK]`      |\n| `❌`     | `[ERROR]`   |\n| `?`     | `[START]`   |\n| `→`      | `->`        |\n| `•`      | `-`         |\n| `—`      | `--`        |\n\n### Step 3 — Write the file via heredoc\n\nUse `run_shell` with the following pattern:\n\n```bash\ncat > path\u002Fto\u002Ffile.ext \u003C\u003C 'EOF'\n...file content here (with Unicode stripped\u002Freplaced if needed)...\nEOF\n```\n\n**Key details:**\n- Use `'EOF'` (single-quoted) as the heredoc delimiter — this disables all\n  shell variable expansion and special character interpretation inside the block.\n- Do **not** indent the closing `EOF` (it must start at column 0).\n- For deeply nested content, choose a delimiter that cannot appear in the\n  content itself (e.g. `'HEREDOC_END'`, `'FILEEND'`).\n\n---\n\n## Example\n\n### Failing call\n\n```python\nwrite_file(\n    path=\"src\u002Fcomponents\u002FStatusPanel.ts\",\n    content=\"\u002F\u002F Status icons\\nconst icons = { ok: '✅', err: '❌', run: '?' };\\n\"\n)\n# → Error: unknown error\n```\n\n### Recovery via heredoc\n\n```bash\ncat > src\u002Fcomponents\u002FStatusPanel.ts \u003C\u003C 'EOF'\n\u002F\u002F Status icons\nconst icons = { ok: '[OK]', err: '[ERROR]', run: '[START]' };\nEOF\n```\n\nOr, if UTF-8 output is acceptable in the environment:\n\n```bash\ncat > src\u002Fcomponents\u002FStatusPanel.ts \u003C\u003C 'EOF'\n\u002F\u002F Status icons\nconst icons = { ok: '✅', err: '❌', run: '?' };\nEOF\n```\n\n---\n\n## Multi-File Scenario\n\nWhen writing several files and one fails, write the others with `write_file`\nas normal and apply the heredoc fallback only to the failing file(s):\n\n```bash\n# Write multiple files that contain Unicode\ncat > src\u002Futils\u002Ficons.ts \u003C\u003C 'EOF'\nexport const ICONS = {\n  success: '[OK]',\n  failure: '[FAIL]',\n  pending: '[...]',\n};\nEOF\n\ncat > src\u002Futils\u002Flabels.ts \u003C\u003C 'EOF'\nexport const LABELS = {\n  title: 'Dashboard',\n  subtitle: 'Real-time status',\n};\nEOF\n```\n\n---\n\n## Important Notes\n\n1. **Always prefer `write_file` first** — only fall back to the heredoc\n   approach when `write_file` fails.\n2. **Verify after writing** — use `run_shell` with `cat path\u002Fto\u002Ffile` or\n   `head -5 path\u002Fto\u002Ffile` to confirm the content was written correctly.\n3. **Directory creation** — `write_file` auto-creates parent directories;\n   the heredoc approach does not. Pre-create directories with\n   `mkdir -p path\u002Fto\u002Fdir` if needed.\n4. **Large files** — heredocs work well for files of any practical size;\n   there is no meaningful shell limit.\n5. **Escaping backslashes** — inside a single-quoted heredoc, backslashes\n   are treated literally (no escaping needed), which is usually desirable.","# Unicode-Safe File Writing\n\n## Problem\n\nThe `write_file` tool may fail with `'unknown error'` when the file content\ncontains multi-byte Unicode characters such as:\n\n- Emoji (e.g. `?`, `✅`, `❌`)\n- Special typographic symbols (e.g. `→`, `•`, `—`, `©`)\n- Non-ASCII characters outside the Latin-1 range\n\nThis is a known encoding limitation of `write_file`.\n\n## Solution\n\nFall back to `run_shell` and write the file using a **shell heredoc**\n(`cat > file \u003C\u003C 'EOF' ... EOF`). The single-quoted delimiter `'EOF'`\nprevents the shell from interpreting any special characters inside the\nblock.\n\n---\n\n## Step-by-Step Recovery\n\n### Step 1 — Detect the failure\n\nIf `write_file` returns an error such as:\n\n```\nError: unknown error\n```\n\nand the content contains non-ASCII characters, assume a Unicode encoding\nissue and proceed to the heredoc fallback.\n\n### Step 2 — Strip or replace problematic characters (if needed)\n\nBefore embedding content in the heredoc, decide whether to:\n\n- **Keep** the characters as-is (works if the shell\u002Fterminal is UTF-8 aware)\n- **Replace** emoji\u002Fsymbols with ASCII equivalents (safest, most portable)\n- **Remove** them entirely\n\nCommon replacements:\n\n| Original | Replacement |\n|----------|-------------|\n| `✅`     | `[OK]`      |\n| `❌`     | `[ERROR]`   |\n| `?`     | `[START]`   |\n| `→`      | `->`        |\n| `•`      | `-`         |\n| `—`      | `--`        |\n\n### Step 3 — Write the file via heredoc\n\nUse `run_shell` with the following pattern:\n\n```bash\ncat > path\u002Fto\u002Ffile.ext \u003C\u003C 'EOF'\n...file content here (with Unicode stripped\u002Freplaced if needed)...\nEOF\n```\n\n**Key details:**\n- Use `'EOF'` (single-quoted) as the heredoc delimiter — this disables all\n  shell variable expansion and special character interpretation inside the block.\n- Do **not** indent the closing `EOF` (it must start at column 0).\n- For deeply nested content, choose a delimiter that cannot appear in the\n  content itself (e.g. `'HEREDOC_END'`, `'FILEEND'`).\n\n---\n\n## Example\n\n### Failing call\n\n```python\nwrite_file(\n    path=\"src\u002Fcomponents\u002FStatusPanel.ts\",\n    content=\"\u002F\u002F Status icons\\nconst icons = { ok: '✅', err: '❌', run: '?' };\\n\"\n)\n# → Error: unknown error\n```\n\n### Recovery via heredoc\n\n```bash\ncat > src\u002Fcomponents\u002FStatusPanel.ts \u003C\u003C 'EOF'\n\u002F\u002F Status icons\nconst icons = { ok: '[OK]', err: '[ERROR]', run: '[START]' };\nEOF\n```\n\nOr, if UTF-8 output is acceptable in the environment:\n\n```bash\ncat > src\u002Fcomponents\u002FStatusPanel.ts \u003C\u003C 'EOF'\n\u002F\u002F Status icons\nconst icons = { ok: '✅', err: '❌', run: '?' };\nEOF\n```\n\n---\n\n## Multi-File Scenario\n\nWhen writing several files and one fails, write the others with `write_file`\nas normal and apply the heredoc fallback only to the failing file(s):\n\n```bash\n# Write multiple files that contain Unicode\ncat > src\u002Futils\u002Ficons.ts \u003C\u003C 'EOF'\nexport const ICONS = {\n  success: '[OK]',\n  failure: '[FAIL]',\n  pending: '[...]',\n};\nEOF\n\ncat > src\u002Futils\u002Flabels.ts \u003C\u003C 'EOF'\nexport const LABELS = {\n  title: 'Dashboard',\n  subtitle: 'Real-time status',\n};\nEOF\n```\n\n---\n\n## Important Notes\n\n1. **Always prefer `write_file` first** — only fall back to the heredoc\n   approach when `write_file` fails.\n2. **Verify after writing** — use `run_shell` with `cat path\u002Fto\u002Ffile` or\n   `head -5 path\u002Fto\u002Ffile` to confirm the content was written correctly.\n3. **Directory creation** — `write_file` auto-creates parent directories;\n   the heredoc approach does not. Pre-create directories with\n   `mkdir -p path\u002Fto\u002Fdir` if needed.\n4. **Large files** — heredocs work well for files of any practical size;\n   there is no meaningful shell limit.\n5. **Escaping backslashes** — inside a single-quoted heredoc, backslashes\n   are treated literally (no escaping needed), which is usually desirable.",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","showcase\u002Fskills\u002Funicode-safe-file-writing","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution","https:\u002F\u002Fgithub.com\u002FUF-gzj","2026-04-16 09:31:03",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill unicode-safe-file-writing",{"tool":63,"command":64},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill unicode-safe-file-writing",{"tool":66,"command":67},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill unicode-safe-file-writing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Funicode-safe-file-writing\u002FSKILL.md",true,[71],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},".skill_id","OTHER","其他",39,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Funicode-safe-file-writing\u002F.skill_id",[78,100,116,124,152,168],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":46},"01M6XCCXD3NCM2YKR3WNGBASPC","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[85,42,86,87,88,89,90,91,92,93,94,95,96,41,97,98,30,99],"check","write special chars ts check","typescript","filters","characters","Existing","type-checking","for","errors","script","output","type","only","template","python",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":46},"01M6XCCT7E3J922Q345PBGSHPN","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[107,108,42,30,109,99,110,111,112,113,114,98,115,35,89,92,94],"readback","write special chars readback","helper","post","via","scripts","cleanup","read","verification",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":46},"01M6XCCMQX1R8B6FECWB3P63T7","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[123,42,89,44,94,111,98,30,99,92],"write special chars heredoc",{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":133,"publishedAt":46},"01M6XCCG41M994JJEX6VN52PEP","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[130],{"categoryNo":131,"categoryName":132,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000033","数据分析师",[134,135,136,137,138,87,139,140,141,142,143,92,144,145,146,147,148,149,150,151],"reference","worldmonitor","worldmonitor reference","architecture","dashboard","css","scheduler","layer","hierarchy","source","extracting","panel","patterns","edge functions","integrations","open","api","data",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":46},"01M6XCCCHWNKG2W4VH9E6A10HF","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[159,160,161,162,92,163,35,164,165,166,167],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":172,"categories":173,"keywords":174,"publishedAt":46},"01M6XCC7X8PKMR2DEW91XGHYSV","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[175,176,177,178,179,180,30,181,182,183],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]