Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add cass-2003/local-workflow-skill --skill string-encodinggit clone --depth 1 https://github.com/cass-2003/local-workflow-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cass-2003/local-workflow-skill/string-encoding)<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/string-encoding"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/string-encoding/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/string-encoding"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/string-encoding.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00187 | $0.03807 |
| Opus 5 | $0.00093 | $0.01903 |
| Sonnet 5 | $0.00037 | $0.00761 |
| Haiku 4.5 | $0.00019 | $0.00381 |
Grade C, and why
string-encoding scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Hidden instructionshighPrompt injection
Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.
例子:emoji 👨👩👧 (家庭) ``` Bytes (UTF-8): 11 字节 F0 9F 91 A8 E2 80 8D F0 9F 91 A9 E2 80 8D F0 9F 91 A7 Code Points: 5 个 U+1F468 U+200D U+1F469 U+200D U+1F467 (👨) (ZWJ) (👩) (ZWJ) (👧) Grapheme Cluster: 1 个 👨👩👧 ``` J How it starts
The opening of the file, as written. The whole thing — 367 lines — stays where its author put it; the contents beside it link to each section on GitHub.
String Encoding Skill — 字符编码与 Unicode
何时使用
- 处理多语言文本(中文 / 日文 / 韩文 / 阿拉伯文 / emoji)
- 字符串长度计算结果"不对"(emoji 算 2、中文算 3 等)
- 跨系统传输文本出现
?/ 乱码 /' '(mojibake) - CSV / Excel 中文乱码
- URL / Base64 / HTML 编码场景
- 截断字符串导致显示半个字符
一、概念分层(必须先理清)
[ Bytes ] 字节流(0-255 整数)
↑
[ Encoding ] UTF-8 / UTF-16 / GBK / Shift-JIS
↑
[ Code Points ] Unicode 整数(U+0000 到 U+10FFFF)
↑
[ Grapheme Clusters ] 用户感知的"字符"(如 emoji ZWJ 组合)
↑
[ User-Perceived Character ] "我看见的一个字"
例子:emoji 👨👩👧 (家庭)
Bytes (UTF-8): 11 字节 F0 9F 91 A8 E2 80 8D F0 9F 91 A9 E2 80 8D F0 9F 91 A7
Code Points: 5 个 U+1F468 U+200D U+1F469 U+200D U+1F467
(👨) (ZWJ) (👩) (ZWJ) (👧)
Grapheme Cluster: 1 个 👨👩👧
JS '👨👩👧'.length === 8(UTF-16 code unit 数)—— 对开发者基本无意义。用户看到的是 1 个字符。
二、UTF-8(必学)
U+0000-U+007F 1 字节 ASCII 兼容
U+0080-U+07FF 2 字节 110xxxxx 10xxxxxx
U+0800-U+FFFF 3 字节 1110xxxx 10xxxxxx 10xxxxxx
U+10000-U+10FFFF 4 字节 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
特性:
- ✅ ASCII 兼容(旧文本不动)
- ✅ 自同步(任意字节看高位 bit 知道是首字节还是续字节)
- ✅ 无字节序问题
- ✅ 网络 / 文件存储事实标准
永远默认 UTF-8。其他编码仅出于历史 / 第三方系统兼容。
三、UTF-16(JS / Java / Windows 内部)
U+0000-U+FFFF 2 字节(BMP)
U+10000-U+10FFFF 4 字节(surrogate pair)
Surrogate pair:超出 BMP 的字符用两个 16-bit code unit 表示:
高代理:D800-DBFF
低代理:DC00-DFFF
emoji / 罕见汉字 / 古文字都在 BMP 外 → JS .length 算成 2:
'😀'.length // 2 (UTF-16 code units)
[...'😀'].length // 1 (code points)
四、各语言字符串模型
| 语言 | 内部编码 | len(s) 含义 |
|---|---|---|
| JS / Java / C# | UTF-16 | code units 数(emoji 算 2) |
| Go | UTF-8 (string 是 byte 序列) |
字节数(len("中") == 3) |
| Python 3 | 抽象 / 内部 PEP 393 | code points 数 |
| Rust | UTF-8 (str 是 byte) |
字节数 |
| Swift | UTF-8 / 抽象 | grapheme clusters 数 ✨ |
| Ruby | encoding-aware string | 取决于编码 |
Swift 是唯一字符串 API 默认 grapheme:"👨👩👧".count == 1。其他语言要库支持。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 367 lines · 187 tokens per session scan C cb0420c28d19
string-encoding is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 187 tokens to every session and 3,807 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
delphi-encoding
Especialista em encoding de arquivos Delphi. Auto-ativa quando detectar arquivos .pas/.dfm/.dpr/.dpk/.inc/.fmx, problemas de encoding, BOM, acentos quebrados, mojibake, ou menções a "encoding", "UTF-8", "BOM", "ANSI", "acentos", "ç", "ã".
laravel-i18n
Use when implementing Laravel translations — (), transchoice(), lang files, pluralization, locale middleware, or formatting.
copy-tuner-to-locales-migrate-prefix
A workflow for moving internationalized text from CopyTuner, a centralized translation-management service, into Rails' local YAML translation files one key prefix at a time.
crowdin-api-client
Use when implementing, refactoring, or reviewing @crowdin/crowdin-api-client usage in any JavaScript or TypeScript project, especially for endpoint selection, request/response typing, pagination, uploads, retries, timeouts, or CrowdinError handling.
fec-refactor-clean
A safe cleanup workflow for unused front-end code, exports, routes, components, and dependencies.
swift-localization
Swift localization and internationalization patterns for multilingual Apple-platform apps. Use when Codex needs to build, refactor, debug, or review String Catalogs, localized SwiftUI text, String(localized:) usage, pluralization, locale-aware formatting, right-to-left behavior, or translation workflows across many…