Start here — the plan¶
Level: reference · the map
One line: The chapters that have to be read in order, from what is a byte to why is the euro sign wrong in this SAP file; the ones you can take at any point; and the four checkpoints, which are the four things you said on day one that you could not yet do.
Where you start¶
Written down on 2026-09-05, so it can be looked back at:
| You said you could not yet… | Which is the subject of | You will be able to after |
|---|---|---|
Convert 0x41 ↔ 65 ↔ 0b01000001 by hand |
01_Bits_and_Bytes | Hex is a shorthand |
| Explain code point vs UTF-8 bytes | 02_Characters + 03_Encodings | UTF-8 by hand |
Explain Python str vs bytes |
04_Python | Encode, decode and errors |
Explain Rust String vs &str vs char |
05_Rust | char is four bytes |
Those four are the checkpoints. Each is a question you can put to yourself with no computer; when the answer comes easily, that chapter is done. The library was built so that the four fall out in that order, because each one needs the one before: you cannot explain UTF-8 bytes without knowing what a byte is, and String vs &str is not confusing at all once "bytes that promise UTF-8" is a sentence you already believe.
Three tools, all of them: Python for the shortest expression of each idea, the terminal (xxd, od, printf, iconv) for the actual bytes on an actual pipe, and Rust for the same idea with the width and the encoding written into the type. Three goals: general fluency, Rust strings, and real SAP data — which is why 07_Real_Data is a set of interface bugs rather than more theory.
The order¶
flowchart LR
B["01 Bits & Bytes<br/>a byte, hex, a dump"] --> C["02 Characters<br/>ASCII → code pages → Unicode"]
C --> E["03 Encodings<br/>UTF-8 by hand, UTF-16, BOM, mojibake"]
E --> P["04 Python<br/>str / bytes / open / errors"]
E --> R["05 Rust<br/>String / &str / char"]
B --> T["06 Terminal<br/>printf, iconv, locale, file"]
P --> D["07 Real data<br/>SAP code pages, BOM, CRLF…"]
R --> D
T --> D
E --> X["08 Build your own<br/>the Tribit project"]
R --> X
The spine — read these in order¶
The chapters the diagram above is about. Each one needs the one before it.
| Chapter | What it settles | Written / stub |
|---|---|---|
| 01_Bits_and_Bytes | A byte is 0..255 with no meaning of its own; hex is bits four at a time; a hex dump is three columns | 9 / 0 |
| 02_Characters | A character is a number by agreement — 128, then 256 with everybody's own top half, then one numbering for all | 18 / 1 |
| 03_Encodings | How a code point becomes bytes: UTF-8 by hand, UTF-16, byte order, and mojibake as the wrong table | 12 / 0 |
| 04_Python | str vs bytes, the errors policies, open(), normalization, binary formats |
6 / 1 |
| 05_Rust | String is bytes that promise UTF-8; char is a code point; the three from_utf8s; byte slicing |
5 / 0 |
| 06_Terminal | printf, iconv, the locale, and why file only guesses |
12 / 0 |
| 07_Real_Data | SAP code pages, mojibake repair, the BOM in a CSV, byte-width fields, packing a binary record, 1252 vs Latin-1, CRLF, collation | 8 / 0 |
| 08_Build_Your_Own | A project: the Tribit format — your own code points, a 3-bit variable-length encoding, a container, a viewer — specified with test vectors for a Rust implementation, then the record type, length and checksum any format needs before it ships | 2 / 0 |
Read these at any point¶
These are off the diagram on purpose: none of them depends on the spine past chapter 1, and two are the chapters a reader most often arrives wanting — 10_Best_Practices, which is what to do rather than how it works, and 13_Documentation, which is the one whose subject is already on your machine. ROADMAP.md, under Written out of order, on purpose, says why each was written before the chapters it sits after.
| Chapter | What it settles | Written / stub |
|---|---|---|
| 09_History | Nobody designed the mess: every strange rule is a fossil — a sensible decision that outlived the constraint that made it sensible | 4 / 0 |
| 10_Best_Practices | What to actually do on Monday, and why the modern answer is short | 5 / 0 |
| 11_Tools | grep, find, sort, tr — none of them is about encodings, and every one has already made an encoding decision for you without saying so |
22 / 0 |
| 12_Adversarial | The shapes text bugs take when somebody chooses the bytes on purpose, each with the one-line rule that closes it | 5 / 0 |
| 13_Documentation | The primary material already on your machine under /usr/share/man — and the fact that it is documentation of your machine, with a date on it |
3 / 0 |
| 15_Hex | What each operation in a hex editor's Hex Operations dialog does to the bytes, and which of the dialog's settings can change the answer | 20 / 0 |
| 14_Resources | Not a chapter of the course: the things you review, print, or come back to once the reading is done | 3 / 0 |
The Written / stub column is generated, not typed. It is the one thing on this page that counts pages living in other files, which is the claim that goes false when you touch a file that is not this one — and on 2026-09-07 all eight cells were wrong at once, 3 / 0 against an actual seven. python3 tools/check_chapter_status.py --fix writes them from the tree, and CI fails if they drift; the same gate checks that every chapter has a row here, that every lesson has a row in its chapter's table, and that ROADMAP.md agrees with both. So the numbers are worth reading, and so is the roadmap they summarise.
A stub is a page with its questions written down and no example behind it yet; it carries a notice saying so. Stubs exist so the plan has a shape and every page has its permanent address before the prose does. They are written in the order above, and the ROADMAP says which is next.
How to work a lesson¶
- Read the
One lineand stop. Try to say why it might be true before reading on. - Run all three examples from the
Try itblock. The output on the page was produced by exactly those files, so what you see should match to the character; if it does not, that is interesting. - Do the pencil exercise at the end of
Try it. Every lesson has one that needs no machine, and it is the part that sticks. - Read the bridge (If you are coming from Python or ABAP). It says what you already know that transfers, and what the new language enforces that the old one left to habit.
One lesson per sitting. The chapters are short on purpose.
What not to start with¶
- Not Rust strings first.
Stringvs&strlooks like an ownership question and is really an encoding question in disguise. Chapters 1–3 first, and the Rust chapter takes an afternoon. - Not normalization before code points.
'é' == 'é'beingFalsemakes no sense until a code point is a number to you. - Not the SAP chapter before mojibake. Every page there is a special case of Mojibake with a code-page number attached.
Where C fits¶
C is the language where a string is the bytes: char is one byte, strlen counts bytes up to the first NUL, and "café" is five bytes plus a terminator with nothing in the language that knows about characters. That is the truth Python hides behind str and Rust enforces with &str versus &[u8], so one look at it in C makes both of the others click. It is not a fourth track here — the pointer arithmetic and wchar_t would cost more than they teach — but a short The C view section sits on the lessons where it sharpens the point, compiled and checked like every other example. One is on Control characters, where strlen stops at a NUL that Python and Rust carry happily. The one to read first is on UTF-8 by hand: with no character type and no library to call, the encoder there is the pencil method, and it is ten lines.
Where Go fits¶
Go is here because some of what this library teaches is a fact about Go: its rune, the word for one code point in every Go string loop, is an int32 that checks nothing, and its decoder counts a broken byte differently from Python's. Like C, it is an aside rather than a track — compiled and checked like every other example, on the pages where Go itself is the subject. The first is rune is an int32.
When you want more than the lessons¶
RESOURCES.md is the outside reading: the one Stack Overflow answer everybody links, the two articles every programmer is told to read, the books, four videos, the tools that let you look a character up, and the katas that ask you to write the real UTF-8 encoder. Every link on it was checked the day it was added.
The project in 08_Build_Your_Own can be started any time after chapter 1; its layers 2 and 3 need nothing but bits, and layer 1 is more fun once chapter 2 has explained what a code page is.
Siblings¶
This library is built exactly like rust-learning-library ↗ and math-learning-library ↗: one idea per folder, a program behind every claim, and the program's output pasted into the page by a tool rather than a person. Where the Rust library already teaches a thing — u8, hexadecimal, char, the anatomy of a String — the page here links to it and does not repeat it.