encoding-converter
Skill0 starsChanged 6 months agoMITView on GitHub
Convert source files between text encodings. Use when an agent needs to migrate source comments, verify project encoding status, add or remove BOM, convert between encodings such as UTF-8, UTF-8-BOM, GB2312, GBK, Big5, Shift-JIS, UTF-16LE, or UTF-16BE, use git-tracked-file-aware encoding scans, prepare embedded firmware or Keil MDK source files for Chinese comment readability, or roll back tracked encoding-conversion changes.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- youjun011/skillstheir own version, first seen Mar 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- youjun011/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 8 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill to convert source files between text encodings while avoiding accidental double-conversion.
- Distinctive: line 12
Check repository status before changing files:
- Distinctive: line 18
If the project is not already under git, initialize it and commit a baseline before conversion.
- Distinctive: line 40
Commit the encoding migration separately from semantic code changes.
- Very specific: line 53
Use -FirmwareSafe for an initial pass when third-party or vendor trees should remain byte-identical.
- Very specific: line 54
Prefer -IncludeDirs for known application-owned folders such as src, User, FOC, App, or Core/Src.
- Very specific: line 55
Do not include Keil project files such as .uvprojx or .uvoptx unless the user explicitly asks for project-file text conversion.
- Very specific: line 56
After conversion, run the real firmware build.
- Very specific: line 60
Run the scripts from this skill folder, or copy scripts/*.ps1 into the target project if that is more convenient.
- Very specific: line 90
Add or remove BOM according to -TargetEncoding.
- Distinctive: line 98
Use this after conversion and in CI-style checks.
- Very specific: line 116
Prefer -ScanMode Auto for open-source use:
- Very specific: line 120
Use -ScanMode Filesystem when untracked files must be included.
- Very specific: line 121
Use -ScanMode Tracked when a git-only check should fail outside a repository.
- Very specific: line 127
Prefer explicit -SourceEncoding for non-UTF encodings that cannot be reliably auto-detected.
- Distinctive: line 131
Use this only when the conversion result should be discarded.
- Distinctive: line 142
Do not hand-repair already-garbled Chinese text unless the original encoding can be proven.
- Distinctive: line 144
Keep encoding-only commits separate from logic, formatting, and generated-file changes.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Encoding Converter
Use this skill to convert source files between text encodings while avoiding accidental double-conversion. The default workflow remains legacy Chinese source comments to UTF-8 with BOM, but explicit -SourceEncoding and -TargetEncoding parameters support broader conversions.
Workflow
Check repository status before changing files:
git status --short --branch- If the project is not already under git, initialize it and commit a baseline before conversion.
Preview the conversion:
.\scripts\convert-encoding.ps1 -ProjectRoot "C:\Path\To\Project" -WhatIfConvert files:
.\scripts\convert-encoding.ps1 -ProjectRoot "C:\Path\To\Project"Verify the result:
.\scripts\verify-encoding.ps1 -ProjectRoot "C:\Path\To\Project"- Spot-check converted files and run the project build.
- Commit the encoding migration separately from semantic code changes.
Embedded Firmware / Keil Workflow
For MCU firmware projects, keep the first pass narrow and build-verified:
.\scripts\convert-encoding.ps1 `
-ProjectRoot "C:\Path\To\Firmware" `
-FirmwareSafe `
-WhatIf- Use
-FirmwareSafefor an initial pass when third-party or vendor trees should remain byte-identical. It adds common embedded vendor directories such asLibraries,CMSIS,Middlewares,SEGGER, andFreeModbusto-ExcludeDirs. - Prefer
-IncludeDirsfor known application-owned folders such assrc,User,FOC,App, orCore/Src. - Do not include Keil project files such as
.uvprojxor.uvoptxunless the user explicitly asks for project-file text conversion. - After conversion, run the real firmware build. For Keil MDK, inspect the build log for
0 Error(s)instead of trusting only the process exit code.
Script Usage
Run the scripts from this skill folder, or copy scripts/*.ps1 into the target project if that is more convenient. If your agent exposes a skill root path, build the script path from that root:
$skillScripts = "C:\Path\To\agent-skills\encoding-converter\scripts"
& "$skillScripts\convert-encoding.ps1" -ProjectRoot "C:\Path\To\Project" -WhatIfconvert-encoding.ps1
Defaults:
| Parameter | Default | Notes |
-ProjectRoot | current directory | Target project root. |
-SourceEncoding | Auto | Auto detects BOM, ASCII, strict UTF-8, and legacy Chinese byte patterns. Use explicit encodings for reliable mutual conversion. |
-LegacyEncoding | GB2312 | Fallback used when Auto detects legacy Chinese byte patterns. Use GBK, Big5, etc. when appropriate. |
-TargetEncoding | UTF-8-BOM | Supports common .NET names plus aliases such as UTF-8, UTF-8-BOM, UTF-16LE, and UTF-16BE. |
-ConvertAscii | off | Convert ASCII-only files too. By default they are skipped. |
-ScanMode | Auto | Auto uses git tracked files when available, otherwise filesystem scanning. |
-IncludeDirs | empty | Optional scan boundary. Empty means all candidate files. |
-ExcludeFiles | empty | Accepts either relative paths or leaf filenames. |
-ExcludeDirs | generic VCS/dependency/build dirs | Avoid .git, node_modules, build output, and common binary output dirs. |
-FileFilter | common C/C++/assembly source extensions | Add docs such as *.md or *.txt only when explicitly needed. |
-FirmwareSafe | off | Add common embedded vendor directories to -ExcludeDirs. |
-WhatIf | off | Preview only; no writes. |
Behavior:
- Skip files already matching the requested target encoding.
- Skip pure ASCII files unless
-ConvertAsciiis used. - Add or remove BOM according to
-TargetEncoding. - Convert files using explicit source encoding when provided.
- In Auto mode, detect BOM, ASCII, strict UTF-8, and legacy Chinese byte patterns using
-LegacyEncoding. - Skip unknown non-UTF-8 files instead of guessing.
- Return exit code
1only when conversion errors occur.
verify-encoding.ps1
Use this after conversion and in CI-style checks.
.\scripts\verify-encoding.ps1 -ProjectRoot "C:\Path\To\Project"It reports:
- effective scan mode and candidate file count.
- target-encoding files.
- files needing conversion.
- ASCII files skipped by default.
- unknown/unsupported files.
It exits with code 1 when any candidate file still needs conversion or has unknown encoding.
Scan Strategy
Prefer -ScanMode Auto for open-source use:
- In a git worktree, scan only tracked files. This avoids untracked build artifacts and dependency caches.
- Outside git, scan the filesystem using
-FileFilter,-IncludeDirs, and-ExcludeDirs. - Use
-ScanMode Filesystemwhen untracked files must be included. - Use
-ScanMode Trackedwhen a git-only check should fail outside a repository.
Directories are only scan boundaries. Encoding state decides whether a candidate file is converted.
Encoding Notes
Prefer explicit -SourceEncoding for non-UTF encodings that cannot be reliably auto-detected. Auto mode is intentionally conservative; it does not pretend to distinguish every possible legacy encoding.
rollback-encoding.ps1
Use this only when the conversion result should be discarded.
.\scripts\rollback-encoding.ps1 -ProjectRoot "C:\Path\To\Project" -WhatIf
.\scripts\rollback-encoding.ps1 -ProjectRoot "C:\Path\To\Project"The rollback script reverts tracked changes matching -FileFilter from HEAD using git. It does not delete untracked files.
Safety Rules
- Do not hand-repair already-garbled Chinese text unless the original encoding can be proven.
- Decide the firmware vendor boundary before conversion; use
-FirmwareSafe,-IncludeDirs, or explicit-ExcludeDirswhen third-party code should stay byte-identical. - Keep encoding-only commits separate from logic, formatting, and generated-file changes.
- For Keil MDK projects, UTF-8 with BOM is often the safest target for files containing Chinese comments.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

