Advertisement
Data Processing

The Byte-Order Exile: Sorting Names by Bytes Sends Every Accented Name to the Back

A sorted list is a promise that position means something. In the test behind this article, 840 personal names were sorted two ways — by raw byte order...

A sorted list is a promise that position means something. In the test behind this article, 840 personal names were sorted two ways — by raw byte order, the default a database reaches for when nobody specifies otherwise, and by a language-aware key that folds accented letters onto their base forms. The two orderings disagreed on 73,752 of the 352,380 name pairs in the list, a disagreement rate of 20.93%. And the disagreement was not scattered randomly. Every one of the 384 names beginning with an accented Latin letter — all of them, 100% — was exiled by byte order to a position behind every ASCII name in the file, whatever letter the accent decorated.

What The Byte-Order Exile means

The Byte-Order Exile means the systematic displacement of names beginning with accented or otherwise non-ASCII letters when a list is sorted by the numeric values of its characters' encodings rather than by the alphabet its readers use. In byte order, an accented capital letter is not a kind of A or E or O; its encoded value simply sits above the entire ASCII alphabet, so every name it starts falls behind Z. The exile is total and mechanical — it does not misplace accented names by a few positions, the way a fuzzy rule might, but removes them from the alphabet altogether and appends them as a separate, unsorted-feeling block. The measure is twofold: the share of name pairs whose relative order flips between byte order and language-aware order, and the share of accented-initial names that byte order places behind all ASCII names. In this test those figures are 20.93% and 100%.

The two orderings

The language-aware ordering in the test was built with a specific, declared method: each name's sort key was produced by decomposing its characters and stripping the accent marks, so an accented vowel sorts with its plain counterpart. That method is a stand-in for a reader's alphabet, adopted because the machine running the test offered only the C.UTF-8 locale — a limitation stated here rather than hidden, since a full locale collation would refine the key further. Against that key, byte order's behaviour was stark. Of the 352,380 pairs that 840 names form, 73,752 pairs stand in opposite relative order under the two systems — one pair in five (Source: SmartDataAI import test U5, run 2026-11-23; the script and result JSON are filed in this batch's evidence pack).

The Byte-Order Exile: Sorting Names by Bytes Sends Every Accented Name to the Back

The pair count itself is worth a glance, because it explains the size of the disagreement figure. Eight hundred forty names form 352,380 pairs — each name paired with every other, 840 × 839 ÷ 2 (derived) — so a single name dragged from the front of the list to the back flips its order against hundreds of others at once. The 384 exiled names did exactly that, each crossing the entire ASCII block, which is how one sorting rule, applied to one column, manufactures seventy thousand disagreements without misspelling a single name.

The exile figure is the sharper one. The file contained 384 names beginning with an accented Latin letter, and byte order placed 384 of them — 100% — after the last ASCII-initial name. A reader scanning the byte-sorted directory for a colleague whose name begins with an accented A will not find her under A, or near it; she is in the appendix the sort created without telling anyone. The names inside the exiled block are ordered among themselves by the same byte logic, which separates even them from the sequence a reader would expect: accented letters follow byte values, not the alphabet, so the block is not a little alphabet of its own but a second exile inside the first.

Consider what this does to the ordinary machinery built on sorted lists. Binary search assumes the order the searcher believes in; a lookup written against language-aware expectations can miss names that byte order has moved, returning "not found" for a person who is in the directory. Pagination slices the exile into the final pages, where it looks like a data-entry problem rather than a sorting decision. Deduplication passes that compare neighbours will never see an accented name beside its unaccented twin. None of these failures raises an error. The list is sorted — provably, verifiably sorted — in an order its readers do not speak.

Questions, answered

Is byte order simply wrong, then? It is a correct answer to a different question. Byte order sorts encodings, deterministically and fast, and for machine-facing keys that is often exactly what is wanted. The exile appears when the sorted list is human-facing — a directory, a report, a picker — and the order's meaning is the alphabet, not the encoding table.

Why do all accented initials land after Z, without exception? Because the encoded values of accented Latin letters sit above the ASCII range in the encoding the test used. Byte order compares those values numerically, so the outcome is not statistical: any name starting with such a letter must sort after every name starting with an ASCII letter. The 100% figure is a property of the encoding, measured here rather than assumed.

What does the language-aware key do with names that have no accents? It leaves their relative order essentially as a reader expects, which is why the disagreement concentrates where the accents are. The 20.93% of flipped pairs are not random noise across the list; they are the pairs that involve the displaced names, dragged across the ASCII block.

Would a proper locale collation change the numbers? It would change the language-aware side of the comparison — a full collation handles more than initial accents — and so it would move the disagreement rate. The exile itself would not move: byte order's side of the comparison is fixed by the encoding. The test states its key method openly so the figure can be re-derived, and improved on, rather than merely quoted.

How this was measured

The 840 names were synthesised by the test script, mixing ASCII-initial and accented-initial names in declared proportions, and sorted by the script's own two deterministic keys — raw byte order, and the decomposition-based key described above — under a fixed seed of 42. The machine's available locales were limited to C.UTF-8, which is why the accent-stripping key was constructed in-script rather than taken from a system collation; that constraint is part of the measurement, not a footnote to it. The exercise evaluates sorting rules against a constructed name list, not any commercial directory product, and its files are preserved in this batch's evidence pack.

Summary

Sorted by bytes, a directory of 840 names disagrees with a language-aware ordering on 20.93% of all name pairs — and exiles every one of its 384 accented-initial names, 100%, to the back of the list, behind the entire ASCII alphabet. The Byte-Order Exile is not a bug in the sort; it is the sort, faithfully ordering encodings for an audience that reads alphabets. Any human-facing list that has never specified its collation has made this decision already, by default, and the test prices that default at one flipped pair in five.

Sources

Know someone who needs this? Share it.

Advertisement