# MD083 - Detect mojibake due to encoding issues

Aliases: `mojibake`

**Disabled by default.** This rule is opt-in: enable it explicitly with
`extend-enable`. There is no markdownlint equivalent; this is a rumdl-specific
structure rule.

## What this rule does

Mojibake is text that appears corrupted because it was decoded using a wrong character encoding.

This rule detects common Mojibake patterns, such as UTF-8 text that has been misread as Windows-1252 or ISO-8859-1.

Examples of Mojibake include:

- `CafÃ©` instead of `Café`
- `â€“` instead of `–`
- `â€™` instead of `’`

## Why this matters

Encoding problems may replace valid Unicode characters such as ✓, ©, §, or ✅ by weird uncommonly used characters such as âœ“, Â©, Â§, or âœ…

Such issues typically happen when several people work collaboratively using different editors, IDEs, OS and configurations.
Detecting encoding problems early allows the team to identify the causes of the issues and to fix them before they spread.

This rule uses regex-based detection for suspicious character sequences commonly associated with encoding issues.

To fix existing issues in a documentation base, you can use tools such as [`ftfy`](https://github.com/rspeer/python-ftfy/) (in Python)
or [`plsfix`](https://github.com/kevinhu/plsfix) (a reimplementation in Rust).

## Examples

### Incorrect

```text
# CafÃ© menu

This line contains a broken dash â€“ and a broken apostrophe â€™.
```

### Correct

```text
# Café menu

This line contains an en dash – and a typographic apostrophe ’.
```

## Configuration

```toml
[MD083]
ignore = []
ignore-code-blocks = true
```

- `ignore`: A list of exact mojibake sequences to ignore, such as `"â€“"` or `"â€™"`. Default: `[]`.
- `ignore-code-blocks`: Whether to ignore findings inside code, meaning fenced and indented code blocks as well as inline code spans. Default: `true`.

Example:

```toml
[MD083]
ignore = ["â€“", "â€™"]
ignore-code-blocks = false
```

With this configuration, MD083 skips findings for those exact mojibake sequences and also reports mojibake inside code blocks and inline code spans.
