FAILURE MAP
← Case archive

FA-79407 / Barcode symbology encoding / Member archive

Code 128 switches to set C for four digits in mid-data · case 02

Symbols grow when a four-digit run sits between letters, because two switch characters cost more than the pairs save.

Member previewVariant 2 · 3 implementations · 8 checks per implementation

Case contract

Plan Code 128 code sets for printable ASCII data (other characters -> None) as a list of [set, text] segments. Start in C when the data begins with at least 4 digits or is entirely digits of even length >= 2, else B. In C consume digit pairs and fall back to B when fewer than two digits remain in the run. In B switch to C before a run of at least 6 digits, or at least 4 digits that reach the end of the data; an odd run first encodes one digit in B. Empty data yields [["B", ""]].

Why this case matters

Retail, logistics, pharmacy and document workflows depend on encoders that produce exactly the module pattern, code-set switches, separators and quiet zones scanners expect; one misplaced module or separator makes a label unreadable or, worse, scan as different data.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
regression: mid-data switch threshold 0[["C", "74102586"], ["B", "4Q7"], ["C", "0329"], ["B", " "]][["C", "74102586"], ["B", "4Q70329 "]]Failed

MEMBER ARCHIVE

The complete case is available to members.

This record includes three runnable implementations, regression fixtures, execution results, and source hashes.

Member access is invitation-based. Sign in with your invited account to inspect the sources.

Sign in to the archive ↗