Encodings
Caxton reads 18 text encodings. Sixteen are detected when a file opens; two are available only from File ▸ Reopen with Encoding. The status bar shows the encoding and line-ending style of every document.
The 18 encodings
Listed in the order of the Reopen with Encoding menu.
| Encoding | Detected on open | Notes |
|---|---|---|
| UTF-8 | Yes | Validated as UTF-8. An all-ASCII file is read as UTF-8. |
| UTF-8 with BOM | Yes | By its byte order mark. |
| UTF-16 LE | Yes | By its byte order mark, or without one by the pattern of zero bytes. |
| UTF-16 BE | Yes | By its byte order mark, or without one by the pattern of zero bytes. |
| Shift-JIS | Yes | Japanese. |
| EUC-JP | Yes | Japanese. |
| GB18030 | Yes | Simplified Chinese. |
| Big5 | Yes | Traditional Chinese. |
| EUC-KR | Yes | Korean. |
| Windows-1252 | Yes | Western European. Detected even when only a few accented characters appear. |
| ISO-8859-1 | Yes | Western European. |
| Windows-1251 | Yes | Cyrillic. |
| KOI8-R | Yes | Cyrillic. |
| ISO-8859-5 | Yes | Cyrillic. |
| Windows-1250 | Yes | Central European. |
| ISO-8859-2 | Yes | Central European. |
| Windows-1254 | Reopen only | Turkish. Choose it in File ▸ Reopen with Encoding. |
| Windows-1257 | Reopen only | Baltic. Choose it in File ▸ Reopen with Encoding. |
How detection decides
- A byte order mark is definitive.
- Otherwise the file is checked as UTF-8. Detection samples four windows through the file plus the tail: all-ASCII is near certain, and a valid multibyte window confirms UTF-8.
- Only a window that is not valid UTF-8 brings the legacy encodings in. The candidates are scored by how the decoded text reads, and a legacy detection never claims more than 85 percent confidence, which keeps the reopen hint visible for it.
- A stray bad byte in an otherwise UTF-8 file is treated as damage, not as a reason to read the whole file in a legacy encoding.
When a file opens as UTF-8 at low confidence and some bytes look like a legacy encoding, the banner names it (Some bytes look like Windows-1252. Reopen with that encoding?) and Reopen with Encoding preselects it, marked as suggested.
Reopen with Encoding
File ▸ Reopen with Encoding reinterprets the file in any of the 18. A forced encoding wins over the byte order mark. Transcoding runs in the background with progress and a cancel, and one undecodable byte no longer fails the open: only the bytes that cannot be decoded become replacement characters.
- A file reopened this way is written as UTF-8 on Save As, and the panel says so before you click.
- Follow works on reopened files; appended bytes are transcoded as they arrive.
- A file pattern rule can set the encoding for a glob, so a recurring legacy export opens correctly without the menu.
Invalid bytes are left alone
Caxton edits bytes, not a re-encoded copy. Line operations such as duplicate and move are byte-exact even around invalid UTF-8, and Text menu transforms refuse a target that contains invalid UTF-8 and name the line, instead of rewriting those bytes as replacement characters. Mixed international text (CJK, emoji, combining marks) renders and edits correctly, with caret movement that respects grapheme clusters.