string-encoding

string-encoding is a skill for Claude Code, Codex from cass-2003/local-workflow-skill. It costs 187 tokens per session (3,807 once invoked), scanned C, original, MIT.

A guide to how computers store and interpret text, including UTF-8, UTF-16, Unicode code points, and user-perceived characters. It explains why bytes, encoded characters, and visible symbols are not always the same thing.

In plain words
What is it for?
Use it when handling multilingual text, file and network encodings, URL or Base64 data, HTML entities, Unicode normalization, emoji, and cross-language string behavior.
Why use it?
It helps diagnose garbled text, incorrect string lengths, broken emoji, damaged CSV files, and errors caused by cutting text at the wrong boundary.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when handling multilingual text, file and network encodings, URL or Base64 data, HTML entities, Unicode normalization, emoji, and cross-language string behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/string-encoding
Install

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.

Any agent
npx skills add cass-2003/local-workflow-skill --skill string-encoding
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for string-encoding

README.md
[![agentmods](https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/string-encoding/github.svg)](https://agentmods.dev/skills/cass-2003/local-workflow-skill/string-encoding)
Your own site
<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.

agentmods 80×15 button for string-encoding

Your own site · 80×15
<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>
Per session 187 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,807 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 8d ago against content hash cb0420c28d19, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

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
skills/engineering-core/ours/string-encoding/SKILL.md · 367 lines

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。其他语言要库支持。

Read the full file on GitHub · 367 lines

Changes

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.

  1. 8d ago First seen · 367 lines · 187 tokens per session scan C cb0420c28d19

Subscribe to this mod's changes

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.

Related

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", "ç", "ã".

adrianosantostreina/delphi-dev · 80 tokens

laravel-i18n

Use when implementing Laravel translations — (), transchoice(), lang files, pluralization, locale middleware, or formatting.

fusengine/agents · 29 tokens

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.

SonicGarden/copy-tuner-ruby-client · 179 tokens

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.

crowdin/skills · 61 tokens

fec-refactor-clean

A safe cleanup workflow for unused front-end code, exports, routes, components, and dependencies.

bovinphang/frontend-craft · 98 tokens

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…

JakubMikolajek/codex-skills-collection · 75 tokens