on master help sign in
Add section concerning file encodings, see #568
commit00bfbbf8841346d97db12a1bfa90c02359393102 authorsharkdp <davidpeter@web.de> dateFri 11 Oct 2019, 20:37 (7 years ago) parente44045a
1 file changed+12
README.md+12
README.md+12
@@ -549,6 +549,18 @@ are supported (and fall back to 8-bit colors).
549549Please try a different theme (see `bat --list-themes` for a list). The `OneHalfDark` and
550550`OneHalfLight` themes provide grid and line colors that are brighter.
551551
552+### File encodings
553+
554+`bat` natively supports UTF-8 as well as UTF-16. For every other file encoding, you may need to
555+convert to UTF-8 first because the encodings can typically not be auto-detected. You can `iconv`
556+to do so.
557+Example: if you have a PHP file in Latin-1 (ISO-8859-1) encoding, you can call:
558+``` bash
559+iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
560+```
561+Note: you might have to use the `-l`/`--language` option if the syntax can not be auto-detected
562+by `bat`.
563+
552564## Development
553565
554566```bash