Skip to content
Back to skills

Encoding Handler

ASecurity

Handle text encoding across platforms including UTF-8, Windows codepages, and BOM handling.

  • 1,760 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentstypescriptbashbackend

Works with

  • cli
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 2, 2026

npx -y skills add a5c-ai/babysitter --skill encoding-handler --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Encoding Handler?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Encoding Handler
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/a5c-ai-encoding-handler-babysitter/badge)](https://www.skillsdirectory.com/skills/a5c-ai-encoding-handler-babysitter)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: encoding-handler
description: Handle text encoding across platforms including UTF-8, Windows codepages, and BOM handling.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
graph:
  domains: [domain:software-engineering]
  specializations: [specialization:cli-mcp-development]
  skillAreas: [skill-area:cli-design, skill-area:parsing-data-formats]
  roles: [role:backend-engineer, role:platform-engineer]
  workflows: [workflow:feature-development]
  topics: [topic:developer-experience]

---

# Encoding Handler

Handle text encoding across platforms.

## Capabilities

- Detect file encoding
- Convert between encodings
- Handle BOM markers
- Configure Windows codepage support
- Normalize text encoding
- Handle encoding errors

## Generated Patterns

```typescript
import { Buffer } from 'buffer';
import iconv from 'iconv-lite';

export function detectBOM(buffer: Buffer): string | null {
  if (buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) return 'utf-8';
  if (buffer[0] === 0xFF && buffer[1] === 0xFE) return 'utf-16le';
  if (buffer[0] === 0xFE && buffer[1] === 0xFF) return 'utf-16be';
  return null;
}

export function stripBOM(content: string): string {
  return content.charCodeAt(0) === 0xFEFF ? content.slice(1) : content;
}

export function decodeBuffer(buffer: Buffer, encoding = 'utf-8'): string {
  const bom = detectBOM(buffer);
  if (bom) {
    return stripBOM(iconv.decode(buffer, bom));
  }
  return iconv.decode(buffer, encoding);
}

export function encodeString(content: string, encoding = 'utf-8', addBOM = false): Buffer {
  const encoded = iconv.encode(content, encoding);
  if (addBOM && encoding.toLowerCase() === 'utf-8') {
    return Buffer.concat([Buffer.from([0xEF, 0xBB, 0xBF]), encoded]);
  }
  return encoded;
}
```

## Target Processes

- cross-platform-cli-compatibility
- cli-output-formatting
- configuration-management-system

Files in this skill

  • README.md416 B
  • SKILL.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…