- Home
- Skills
- Agents & Orchestration
- Repair Unicode & Text Encoding Bugs
More screenshots
Works with the AI Agents you already use
Repair Unicode & Text Encoding Bugs
Repair Unicode & Text Encoding Bugs is a bounded ToolForge Labs workflow.
$2.99
Repair Unicode & Text Encoding Bugs
Example session with this skill installed
Fix the issue where emojis in our Postgres DB are turning into question marks when fetched by our Node.js API and sent to a legacy CSV exporter. Our DB is UTF-8.
- Read your context and instructions
- Compiled the repair unicode
I have analyzed the data flow from Postgres through the Node.js runtime to your legacy CSV exporter. The issue stems from the CSV export stream defaulting to ascii or latin1 encoding, which cannot represent multi-byte emoji characters, leading to replacement characters (?).
Unicode Repair Strategy
The following patch ensures the Node.js fs.createWriteStream or library equivalent uses the correct encoding and adds a normalization step to prevent drift during the round-trip.
const fs = require('fs');
const { Readable } = require('stream');
// Fix: Explicitly set UTF-8 with BOM for legacy Excel-friendly CSVs
// and ensure NFD normalization if the source data comes from macOS clients
function createLegacyExporter(outputPath) {
// Use UTF-8 with BOM (\ufeff) to force legacy apps (Excel) to recognize encoding
const stream = fs.createWriteStream(outputPath, { encoding: 'utf8' });
stream.write('\ufeff');
return stream;
}
// Deterministic Test Case
function testEmojiPersistence() {
const input = "User_🚀_Report";
const normalized = input.normalize('NFC');
// Verify byte length for UTF-8 (Rocket is 4 bytes)
const buf = Buffer.from(normalized, 'utf8');
if (buf.length !== 15) {
throw new Error(`Encoding mismatch: Expected 15 bytes, got ${buf.length}`);
}
console.log("✓ Unicode invariant check passed: Emojis preserved in buffer.");
}
testEmojiPersistence();
| Component | Current State | Target Invariant | Repair Action |
|---|---|---|---|
| Postgres | UTF-8 | UTF-8 | None required |
| Node.js API | NFD/NFC Mix | NFC (Canonical) | Add .normalize('NFC') on ingress |
| CSV Exporter | Default (Latin1) | UTF-8 + BOM | Explicitly set utf8 and write BOM |
Next steps
- Apply the
.normalize('NFC')call to your database service layer to unify incoming text. - Update the CSV stream configuration to use
utf8instead of the system default. - Run the provided
testEmojiPersistencescript in your CI environment to catch regressions.
Connects securely to your tools. The creator never sees your data.
About this skill
Repair Unicode & Text Encoding Bugs is a bounded ToolForge Labs workflow. Diagnose and repair Unicode decoding/encoding, normalization, byte-to-text boundaries, BOMs, replacement characters, line endings, and cross-service text drift. Works from full repositories or partial context such as snippets, logs, configuration, traces, and architecture notes. Produces concrete repair patterns and focused deterministic tests while preserving existing product/security policy. It works from a full repository or partial evidence such as snippets, logs, configuration, traces, tickets, and architecture notes. The skill preserves existing product and security policy, separates verified facts from assumptions, avoids invented execution claims, and produces concrete repair or review steps with focused deterministic validation or traceable evidence.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 1 month ago
- Passed all security checks, Safe to install