.claude/skills/cloudflare-workers-utf8-github-api/SKILL.md
Fix UTF-8 encoding corruption when Cloudflare Workers send content to GitHub API. Use when: (1) Non-ASCII characters like arrows (→), emojis, or accented letters become corrupted (e.g., → becomes â or â), (2) YAML parsing fails with "non-printable characters" error, (3) Content looks correct locally but corrupted after GitHub commit. Covers charset header and YAML string quoting.
npx skillsauth add Dbochman/dotfiles cloudflare-workers-utf8-github-apiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When sending content from Cloudflare Workers to GitHub's API (especially the
Trees/Blobs API), non-ASCII characters get corrupted. The UTF-8 bytes are
interpreted as Latin-1/ISO-8859-1, causing multi-byte characters to become
garbled sequences like â instead of →.
â, âÂÂ, é appear where Unicode should beconst response = await fetch(`${GITHUB_API}${endpoint}`, {
...options,
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/vnd.github+json',
'Content-Type': 'application/json; charset=utf-8', // ADD charset=utf-8
'User-Agent': 'my-worker',
...options.headers,
},
});
When serializing YAML, detect and quote strings with non-ASCII characters:
function escapeYamlString(value: string): string {
// Check for non-ASCII characters (any character > 127)
const hasNonAscii = /[^\x00-\x7F]/.test(value);
if (
hasNonAscii ||
value.includes(':') ||
value.includes('#') ||
// ... other YAML special chars
) {
// Use double quotes and escape internal quotes/newlines
return `"${value
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\n/g, '\\n')}"`;
}
return value;
}
const response = await fetch(`${GITHUB_API}/repos/.../git/blobs`, {
method: 'POST',
headers: { /* ... with charset=utf-8 */ },
body: JSON.stringify({
content: fileContent,
encoding: 'utf-8', // Explicitly specify encoding
}),
});
Test string: Create migration script (JSON → markdown files)
Before fix:
text: "Create migration script (JSON â markdown files)"
After fix:
text: "Create migration script (JSON → markdown files)"
encoding: 'utf-8' when creating blobs, not encoding: 'base64'
unless you're explicitly base64-encoding the content yourselfdevelopment
Search the web for current information, news, facts, and answers. Use when asked questions about current events, needing to look something up, finding websites, researching topics, or when you need up-to-date information beyond your training data.
development
Summarize any URL, YouTube video, podcast, PDF, or file into concise text. Use when asked to read an article, summarize a link, get the gist of a video or podcast, extract content from a URL, or when you need to understand what a web page or document contains.
development
Play music via Spotify and control Google Home speakers. Use when asked to play music, songs, artists, playlists, podcasts, or control speakers/volume/audio.
testing
Create new OpenClaw skills, modify and improve existing skills, and measure skill performance with evals. Use when users want to create a skill from scratch, update or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. Also use when asked to "make a skill", "turn this into a skill", "improve this skill", or "test this skill".