xiaosong858413 downloadsDetects non-UTF-8 encodings in your vault and safely converts them to UTF-8 with automatic backup. Repairs double-encoded mojibake, exports conversion logs, and supports 10 UI languages.
An Obsidian plugin that detects non-UTF-8 files in your vault and converts them to UTF-8 with safety protection, plus an experimental mojibake repair command for double-encoded text already baked into valid UTF-8 content.
Chinese version: README.zh-CN.md
Obsidian reads every note as UTF-8. Once a vault contains legacy-encoded files (GBK, Big5, Shift-JIS, UTF-16, ...), they open as garbage. This plugin provides the full detect → backup → convert → strip BOM loop with multiple safety valves so a false positive can never corrupt your notes irreversibly.
ÖÐÎÄ or 涓枃 using a triple quality gate, line-by-line repair, and a before/after preview.Alternatively, download the main.js, manifest.json, and versions.json attachments from a GitHub release, or build from source:
git clone https://github.com/xiaosong8584/code-converter.git
cd code-converter
npm install
npm run build # produces main.js
Then copy the folder (or symlink it) into your-vault/.obsidian/plugins/code-converter/ and enable it. Full instructions and troubleshooting: User guide (currently Chinese only).
Open the command palette (Ctrl/Cmd + P) and pick one of:
| Command | What it does |
|---|---|
| Convert current file to UTF-8 | Converts high-confidence files directly; asks for confirmation below the threshold |
| Scan and convert current folder (non-UTF-8 → UTF-8) (VIP) | VIP feature — converts every non-UTF-8 file in the current folder whose extension is in the whitelist (default md;h;hpp;cpp;c;cc;py;txt) |
| Detect encoding of current file (report only) | Reports encoding, BOM, confidence, and a preview without touching the file |
| Repair mojibake in current file (double-encoded repair, experimental) | Shows a before/after preview of the repair before writing anything |
| Export conversion log (JSON) / (Markdown) | Exports the conversion record in either format |
Key settings under Settings → Code Converter: auto-convert on import (on by default, permanently free — this is the plugin's core safety net against Obsidian silently saving a GBK file back as UTF-8 mojibake), file extension whitelist (default md;h;hpp;cpp;c;cc;py;txt, editing requires VIP), confidence threshold, auto backup and backup directory, strip UTF-8 BOM, write UTF-8 BOM, log file, damage warning threshold, interface language (last 6 are VIP), and VIP status.
The core features are free forever: single-file conversion, encoding detection, mojibake repair, conversion log export, backups and rollback, and the first 4 interface languages.
Three features require a VIP activation code:
data.json.docs directory (architecture, encoding pool, i18n/RTL, logging, the repair algorithm, building and versioning), along with the changelog and the contribution guide.MIT (see LICENSE)