# Command-line usage

The `ftfy` command takes UTF-8 input and writes UTF-8 output by default:

```text
usage: ftfy [-h] [-o OUTPUT] [-g] [-e ENCODING] [-n NORMALIZATION]
            [--preserve-entities]
            [filename]
```

| Option | Meaning |
| --- | --- |
| `filename` | Input file; `-` or omission means standard input. |
| `-o`, `--output` | Output file; default is standard output. |
| `-g`, `--guess` | Guess input encoding; overrides `-e` and is risky. |
| `-e`, `--encoding` | Input encoding; default is UTF-8. |
| `-n`, `--normalization` | Unicode normalization; default NFC, or `none`. |
| `--preserve-entities` | Do not decode HTML entities. |
| `-h`, `--help` | Show usage. |

Examples:

```sh
ftfy input.txt
ftfy -e latin-1 input.txt -o fixed.txt
ftfy -g unknown.txt
cat input.txt | ftfy
```

The command refuses to read and write the same file. Decode failures are
reported to standard error with a nonzero exit code.
