detect_encoding
Determine a file's character encoding with a confidence score and BOM detection. Run this before reading text to resolve garbled characters or mojibake.
Instructions
Auto-detect file encoding with confidence score (0-100) and BOM detection. ALWAYS use this first when encountering garbled text or � characters. Use before read_text_file to determine the correct encoding. Parameters: path (required), mode (sample=fast default, chunked=thorough, full=entire file). When the answer is in doubt — low confidence, or a charset this server cannot read — the result also ranks candidates; retry the read with a supported one and ask the user if two are plausible.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | ||
| path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| has_bom | Yes | ||
| encoding | Yes | ||
| candidates | No | ||
| confidence | Yes |