character-encoding-validation

Detect and convert text file character encodings to valid UTF-8.

836|66|Updated Feb 3, 2025
One-click install
npx skills add https://github.com/kreuzberg-dev/html-to-markdown --skill character-encoding-validation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: character-encoding-validation
Source: https://github.com/kreuzberg-dev/html-to-markdown/tree/main/.ai-rulez/domains/safety-sanitization/skills/character-encoding-validation
Command: npx skills add https://github.com/kreuzberg-dev/html-to-markdown --skill character-encoding-validation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures that character encodings are correctly identified and converted to UTF-8, preventing data corruption and display issues caused by mismatched encodings.

Core Features & Use Cases

  • BOM Detection: Identifies Byte Order Marks for UTF-8, UTF-16LE, and UTF-16BE.
  • Meta Tag Analysis: Parses HTML5 charset meta tags and HTTP Content-Type headers.
  • Auto-Detection: Employs the encoding_rs crate for robust encoding auto-detection.
  • Safe Conversion: Guarantees conversion to valid UTF-8, handling errors gracefully.
  • Use Case: Processing user-submitted text files that may arrive with various encodings, ensuring they are consistently handled as UTF-8 for display and storage.

Quick Start

Validate and convert the encoding of the provided text file to UTF-8.

Frequently Asked Questions about character-encoding-validation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect and convert unknown character encodings to UTF-8?▼

To detect and convert character encodings to UTF-8, the Skill analyzes Byte Order Marks (BOM), HTML5 charset meta tags, and HTTP Content-Type headers, then uses encoding_rs for robust auto-detection to ensure valid UTF-8 output.

Why does my text file display garbled characters and how can I fix the encoding?▼

Garbled characters occur from mismatched character encodings. You can fix the encoding by safely detecting the original character set via BOM analysis and converting the text to valid UTF-8, which prevents data corruption and display issues.

What is the best way to process user-submitted text files with various character sets for storage?▼

The best way to process user-submitted text files with various character sets is to auto-detect the encoding using BOM and meta tag analysis, then safely convert the data to valid UTF-8 for consistent display and storage.

Does this encoding conversion approach handle UTF-16LE and UTF-16BE Byte Order Marks?▼

Yes, this encoding conversion approach handles UTF-16LE and UTF-16BE Byte Order Marks. It identifies BOMs for UTF-8, UTF-16LE, and UTF-16BE to accurately detect the file's character set before conversion.

How are character encoding conversion errors handled during UTF-8 sanitization?▼

During UTF-8 sanitization, character encoding conversion errors are handled gracefully to guarantee valid UTF-8 output. The safe conversion mechanism prevents data corruption when encountering mismatched or unsupported encodings.

Can I use HTML5 charset meta tags to identify the encoding of a document?▼

Yes, you can identify the encoding of a document by parsing HTML5 charset meta tags and HTTP Content-Type headers. This analysis runs alongside BOM detection and encoding_rs auto-detection to determine the correct character set.