fix-file-encoding

Detect and convert legacy-encoded text files to UTF-8 with PowerShell.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/CloudyWing/ai-dotfiles --skill fix-file-encoding
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fix-file-encoding
Source: https://github.com/CloudyWing/ai-dotfiles/tree/main/skills/fix-file-encoding
Command: npx skills add https://github.com/CloudyWing/ai-dotfiles --skill fix-file-encoding

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detects files that appear as garbled text due to legacy encodings (Big5/ANSI) or incorrect BOM usage and converts them to the appropriate UTF-8 variant so source files and text assets display correctly across tools and platforms.

Core Features & Use Cases

  • File discovery and confirmation: List matching files by path or glob and let the user confirm the set to process.
  • Extension-driven target encoding: Map file extensions and project framework (e.g., .ps1, .csv, .cs, .vb, .aspx, .master, .cshtml) to a target encoding policy including UTF-8 with or without BOM.
  • Heuristic detection and conversion: Detect encoding via byte-marker checks and Big5 fallback, skip binary files, convert using PowerShell with correct BOM handling, and present a conversion summary for review.
  • Use Case: Fix mixed-encoding legacy repositories where some scripts require BOM while most source files should be UTF-8 without BOM.

Quick Start

Run the fix-file-encoding skill on the repository by saying /fix-file-encoding path/to/files_or_glob and confirm the listed files when prompted.

Frequently Asked Questions about fix-file-encoding

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

FAQPage Schema
How do I fix garbled Big5 or ANSI file encodings in a legacy code repository?

Fixing garbled Big5 or ANSI file encodings requires detecting byte markers and applying a Big5 fallback to identify mismatched text assets, then converting them to UTF-8. This process maps target encodings by file extension to ensure source files display correctly across platforms.

How do I convert PowerShell scripts to UTF-8 with or without BOM?

To convert PowerShell scripts to UTF-8 with or without BOM, the conversion process maps the .ps1 file extension to a target encoding policy and executes via PowerShell. This applies correct BOM handling so scripts execute without display or parsing issues.

Does the encoding conversion tool work with mixed-language projects containing .cs and .aspx files?

Yes, the encoding conversion works with mixed-language projects containing .cs and .aspx files. It determines target encoding by evaluating the file extension and project framework, ensuring each text asset receives the appropriate UTF-8 variant.

Why do .csv and .cshtml files display garbled text and how do I resolve it?

Files like .csv and .cshtml display garbled text due to legacy ANSI encodings or incorrect BOM usage. You resolve this by running heuristic byte-marker checks to detect the source encoding and converting the files to the correct UTF-8 variant.

What is the best way to bulk convert mixed-encoding files to UTF-8?

The best way to bulk convert mixed-encoding files to UTF-8 is to list matching files by path or glob, confirm the set to process, and execute conversions using PowerShell. This approach skips binary files and provides a conversion summary for review.