Encoding & ANSEL
A GEDCOM file is plain text, but “plain text” hides a choice: which encoding maps the file’s bytes
to actual characters. Get it wrong and Müller becomes Müller or worse. Older genealogy files —
especially from legacy software — often use ANSEL, an encoding you’ll meet almost nowhere else.
You don’t have to think about any of this. When you import a file, Linea Codex inspects the raw bytes, works out the encoding, and decodes your names and places correctly — ANSEL included. This page is the detail behind that promise: how detection runs, what’s supported, what ANSEL is, and how to take manual control when you want it.
How detection runs
Section titled “How detection runs”Detection is a pipeline of ordered stages. Each looks at the file’s bytes; the first stage that recognises the encoding wins, and later stages aren’t consulted. The stages, in order:
| # | Stage | What it looks for | Result |
|---|---|---|---|
| 1 | Byte-order mark (BOM) | A leading EF BB BF (UTF-8) or FF FE / FE FF (UTF-16) | UTF-8 or UTF-16 (UNICODE), authoritatively |
| 2 | UTF-16 without a BOM | A regular pattern of 00 (NUL) bytes in alternating positions | UTF-16 LE or BE |
| 3 | ANSEL heuristic | The byte patterns characteristic of ANSEL (see below) | ANSEL |
| 4 | Statistical analysis | Byte-frequency analysis to identify the most likely encoding | Whatever scores highest (e.g. a Windows code page) |
| 5 | CHAR header scan | The 1 CHAR <value> line in the header, read as ASCII | The encoding the file declares |
| 6 | Unknown | Nothing matched with confidence | Flagged for you to choose |
A few things worth knowing about this order:
- A BOM is trusted above everything, including the
CHARheader — the bytes on disk are the ground truth, and a BOM is unambiguous. - The
CHARheader is consulted late, not first. A declared1 CHARvalue can be wrong (software that writes one encoding but labels it another is common), so the byte-level evidence is weighed first. The header is the tie-breaker, not the oracle. - The
CHARscan understands more than the four standard GEDCOM values. Well-known non-standard labels such asANSI(Windows-1252),IBMPC(CP437), andMACINTOSHare recognised, and any value the browser’s decoder accepts is honoured as a fallback. - If no stage is confident, the encoding is reported as undetermined rather than guessed wrongly — and the import UI asks you to pick (see Overriding the detected encoding).
Supported encodings
Section titled “Supported encodings”Linea Codex reads far more than the encodings GEDCOM officially blesses, because real files use them. The four standard GEDCOM encodings are handled natively; everything else is decoded through the browser’s built-in text decoder.
| Encoding | Notes |
|---|---|
| UTF-8 | The modern default; the only encoding GEDCOM 7.0 permits. |
| UNICODE | In GEDCOM, UNICODE means UTF-16 (little- or big-endian). |
| ASCII | 7-bit; a subset of both UTF-8 and ANSEL. |
| ANSEL | The legacy genealogy encoding — see the next section. |
Beyond these, a broad set of legacy code pages is available for import and export, including the Windows code pages (1250–1258), the ISO 8859 family, CP437 / CP850 / CP866 (DOS), classic Macintosh, and KOI8-R / KOI8-U (Cyrillic). These are the encodings offered when you override detection or choose an output encoding.
Which encodings each GEDCOM version allows
Section titled “Which encodings each GEDCOM version allows”What a file may declare depends on its version. This is the encoding side of the versions & conversion matrix:
| Version | Permitted encodings (HEAD.CHAR) | Default |
|---|---|---|
| 5.5 | ANSEL, UNICODE, ASCII | ANSEL |
| 5.5.1 | ANSEL, UTF-8, UNICODE, ASCII | ANSEL |
| 7.0 | UTF-8 only | — (UTF-8; an optional BOM may lead the file) |
GEDCOM 7.0 dropped the CHAR header entirely: every 7.0 file is UTF-8, full stop. This is why
converting to 7.0 always lands on a UTF-8-compatible encoding — there’s no
other option to land on.
What ANSEL is
Section titled “What ANSEL is”ANSEL (the American National Standard for Extended Latin) was the default character set for GEDCOM
5.5 and 5.5.1, so a large share of older genealogy files are encoded in it. It’s a single-byte
encoding: bytes 0x00–0x7F are plain ASCII, and the upper range carries the accented and special
letters genealogy needs.
ANSEL has one trait that makes it unusual, and it’s the reason a generic text decoder mangles it:
- Combining diacritics come before the base letter — the opposite of Unicode, where the accent follows the letter it modifies.
- A handful of upper-range bytes are precomposed special characters in their own right —
Ł,Ø,Đ,Æ, the British pound sign, the euro sign, and so on. - The bytes
0x80–0x9F(and a few others) are simply unused — their presence is a strong hint the file isn’t ANSEL, which is exactly what the detection heuristic keys on.
Mapping ANSEL to Unicode
Section titled “Mapping ANSEL to Unicode”Decoding ANSEL isn’t a byte-for-byte table lookup — it’s a reorder. When Linea Codex reads an ANSEL file it:
- Reads the leading combining mark(s),
- reorders them to follow the base letter (Unicode order), and
- precomposes the result into a single character where one exists (so
éis one code point, not a bareeplus a floating accent).
Writing ANSEL reverses this: it decomposes the precomposed character and emits the diacritic first.
A worked example — é (e with acute):
ANSEL bytes: E2 65 (acute-accent byte, then the letter "e")Decoded order: e + ◌́ (base letter, then combining acute — U+0065 U+0301)Precomposed: é (U+00E9)Notice the byte order: E2 (the acute) precedes 65 (the e). A decoder that assumed Unicode order
would read it as an accent floating on whatever came before, which is how ANSEL files turn to mojibake
in tools that don’t know the convention. Linea Codex’s ANSEL codec handles the reorder and
precomposition both ways, so a round-trip through the app preserves your accented names exactly.
Overriding the detected encoding
Section titled “Overriding the detected encoding”Detection is right the overwhelming majority of the time, but you stay in control. On the start page’s import dialog, the detected encoding is shown inline (Detected: …) so you can confirm it at a glance. If you disagree — or if detection couldn’t decide and shows Could not detect file encoding. Please select manually. — open the Encoding dropdown and pick the right one before importing. There’s no extra confirmation step: your choice takes effect when you import.
When you start a new project instead of importing, you choose the encoding up front alongside the GEDCOM version. Picking 7.0 locks the encoding to UTF-8 (GEDCOM 7.0 requires UTF-8 encoding.), since that’s the only encoding the version allows.
Choosing an output encoding on export
Section titled “Choosing an output encoding on export”The encoding a file was imported with is fixed inside the project. When you export, though, you can write the file in a different encoding to suit wherever it’s headed — without touching the project’s internal encoding.
File → Export As… opens a picker for the target encoding and validates the whole document against it. It tells you either All characters are compatible with … or exactly which characters can’t be represented and how often each occurs, with a nudge to Select an encoding that supports all characters in the document, such as UTF-8. The full walkthrough — including GEDZIP and ZIP archives — is in Saving & exporting.
The same character-compatibility check runs automatically when you convert to a version whose encodings can’t hold your data, or when you save a file whose imported encoding isn’t a standard GEDCOM one — Linea Codex surfaces the mismatch and offers a compatible encoding rather than silently dropping characters.
See also: Import a file · Saving & exporting · Converting GEDCOM versions · Versions & conversion matrix.