{"abstract":"Odd-length data ending in a character with value 32 or more corrupts the terminator.","category":"Barcode symbology encoding","checks":8,"contract":"Encode the data part of a QR alphanumeric segment. Character values: 0-9 -> 0-9, A-Z -> 10-35, space 36, $ 37, % 38, * 39, + 40, - 41, . 42, / 43, : 44. Each pair becomes 45*first + second in 11 bits, a final single character becomes its value in 6 bits. Characters outside the set return None.","evaluation_group":"w2-barcode-symbology-encoding-qr-alnum-bitstream","failed_approach":"Using the 11-bit pair width wastes five bits and desynchronises the count.","family":"w2-barcode-symbology-encoding-qr-alnum-bitstream-single-width","id":"FA-79681","implementations":{"attempt":{"sha256":"0afb57f0e4ac2ef0b01c06130b3896089b97060e77bce7f761a9f8cf3dca82e7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'\n    if any(c not in ALNUM for c in s):\n        return None\n    bits = ''\n    for i in range(0, len(s) - 1, 2):\n        v = 45 * ALNUM.index(s[i]) + ALNUM.index(s[i + 1])\n        bits += format(v, '011b')\n    if len(s) % 2:\n        bits += format(ALNUM.index(s[-1]), '011b')\n    return bits\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['R1K', '10011000000010100'], ['IG:', '01100111010101100'], ['YL-V1BV', '110000011111110101010000000111000011111'], ['', ''], ['A8CG', '0011100101001000101100'], ['L1', '01110110010'], ['9A', '00110011111'], ['4', '000100']], [[':HKK4', '1111100110101110011000000100'], ['A2L0$4A', '001110001000111011000111010000101001010'], ['Z6UKSE', '110001011011010101101010011111010'], ['VK5/1S', '101100001110010000110000001001001'], ['I1', '01100101011'], ['', ''], ['0-KJ', '0000010100101110010111'], ['E', '001110']], [['Q', '011010'], ['X', '100001'], ['J$L', '01101111100010101'], ['20Y%', '0000101101011000100000'], ['', ''], ['$K', '11010010101'], ['MN', '01111110101'], ['ZMHUK', '1100011110101100011011010100']], [['TX4', '10100111010000100'], ['CBS', '01000100111011100'], ['OJOU', '1000100101110001010110'], ['', ''], ['2R9L', '0000111010100110101010'], ['*AB1', '1101110010100111110000'], ['M+1GDK', '100000001100000011110101001011101'], ['HE9', '01100001011001001']], [['0 6-C', '0000010010000100110111001100'], ['M2R:*', '0111110000010011101011100111'], ['P', '011001'], ['', ''], ['VS63', '1011000111100100010001'], ['EG$9', '0101000011011010001010'], [':X', '11111011101'], ['%KU', '11011000010011110']]]\nlabels = [\"regression: trailing character bit width\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"731dd11d08459866e99f36dbda2b40b1bcaf56856cb96457816bcdff470c8996","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'\n    if any(c not in ALNUM for c in s):\n        return None\n    bits = ''\n    for i in range(0, len(s) - 1, 2):\n        v = 45 * ALNUM.index(s[i]) + ALNUM.index(s[i + 1])\n        bits += format(v, '011b')\n    if len(s) % 2:\n        bits += format(ALNUM.index(s[-1]), '05b')\n    return bits\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['R1K', '10011000000010100'], ['IG:', '01100111010101100'], ['YL-V1BV', '110000011111110101010000000111000011111'], ['', ''], ['A8CG', '0011100101001000101100'], ['L1', '01110110010'], ['9A', '00110011111'], ['4', '000100']], [[':HKK4', '1111100110101110011000000100'], ['A2L0$4A', '001110001000111011000111010000101001010'], ['Z6UKSE', '110001011011010101101010011111010'], ['VK5/1S', '101100001110010000110000001001001'], ['I1', '01100101011'], ['', ''], ['0-KJ', '0000010100101110010111'], ['E', '001110']], [['Q', '011010'], ['X', '100001'], ['J$L', '01101111100010101'], ['20Y%', '0000101101011000100000'], ['', ''], ['$K', '11010010101'], ['MN', '01111110101'], ['ZMHUK', '1100011110101100011011010100']], [['TX4', '10100111010000100'], ['CBS', '01000100111011100'], ['OJOU', '1000100101110001010110'], ['', ''], ['2R9L', '0000111010100110101010'], ['*AB1', '1101110010100111110000'], ['M+1GDK', '100000001100000011110101001011101'], ['HE9', '01100001011001001']], [['0 6-C', '0000010010000100110111001100'], ['M2R:*', '0111110000010011101011100111'], ['P', '011001'], ['', ''], ['VS63', '1011000111100100010001'], ['EG$9', '0101000011011010001010'], [':X', '11111011101'], ['%KU', '11011000010011110']]]\nlabels = [\"regression: trailing character bit width\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"98c00a94040e4a79ead0f1bbf2a2a6744c9db4dd91dce10976bd3ffb528b119f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'\n    if any(c not in ALNUM for c in s):\n        return None\n    bits = ''\n    for i in range(0, len(s) - 1, 2):\n        v = 45 * ALNUM.index(s[i]) + ALNUM.index(s[i + 1])\n        bits += format(v, '011b')\n    if len(s) % 2:\n        bits += format(ALNUM.index(s[-1]), '06b')\n    return bits\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['R1K', '10011000000010100'], ['IG:', '01100111010101100'], ['YL-V1BV', '110000011111110101010000000111000011111'], ['', ''], ['A8CG', '0011100101001000101100'], ['L1', '01110110010'], ['9A', '00110011111'], ['4', '000100']], [[':HKK4', '1111100110101110011000000100'], ['A2L0$4A', '001110001000111011000111010000101001010'], ['Z6UKSE', '110001011011010101101010011111010'], ['VK5/1S', '101100001110010000110000001001001'], ['I1', '01100101011'], ['', ''], ['0-KJ', '0000010100101110010111'], ['E', '001110']], [['Q', '011010'], ['X', '100001'], ['J$L', '01101111100010101'], ['20Y%', '0000101101011000100000'], ['', ''], ['$K', '11010010101'], ['MN', '01111110101'], ['ZMHUK', '1100011110101100011011010100']], [['TX4', '10100111010000100'], ['CBS', '01000100111011100'], ['OJOU', '1000100101110001010110'], ['', ''], ['2R9L', '0000111010100110101010'], ['*AB1', '1101110010100111110000'], ['M+1GDK', '100000001100000011110101001011101'], ['HE9', '01100001011001001']], [['0 6-C', '0000010010000100110111001100'], ['M2R:*', '0111110000010011101011100111'], ['P', '011001'], ['', ''], ['VS63', '1011000111100100010001'], ['EG$9', '0101000011011010001010'], [':X', '11111011101'], ['%KU', '11011000010011110']]]\nlabels = [\"regression: trailing character bit width\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-barcode-symbology-encoding-qr-alnum-bitstream-single-width","generated_at":"2026-09-29T14:49:46.900356+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"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.","repair":"Write the trailing character in 6 bits.","root_cause":"The single trailing character uses 5 bits, which cannot hold values 32..44.","sha256":"e85cbcfb0c545ca44264b918fcec52b70576723c64bbeb3068c07a88bd212064","title":"QR alphanumeric trailing character is written in 5 bits · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.516,"exit_code":1,"observations":[{"actual":"1001100000000000010100","check":"regression: trailing character bit width 0","expected":"10011000000010100","passed":false},{"actual":"0110011101000000101100","check":"repair trap 1","expected":"01100111010101100","passed":false},{"actual":"11000001111111010101000000011100000000011111","check":"combined fault 2","expected":"110000011111110101010000000111000011111","passed":false},{"actual":"","check":"control 3","expected":"","passed":true},{"actual":"0011100101001000101100","check":"control 4","expected":"0011100101001000101100","passed":true},{"actual":"01110110010","check":"boundary 5","expected":"01110110010","passed":true},{"actual":"00110011111","check":"boundary 6","expected":"00110011111","passed":true},{"actual":"00000000100","check":"control 7","expected":"000100","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: trailing character bit width 0\", \"actual\": \"1001100000000000010100\", \"expected\": \"10011000000010100\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"0110011101000000101100\", \"expected\": \"01100111010101100\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"11000001111111010101000000011100000000011111\", \"expected\": \"110000011111110101010000000111000011111\", \"passed\": false}, {\"check\": \"control 3\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"0011100101001000101100\", \"expected\": \"0011100101001000101100\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"01110110010\", \"expected\": \"01110110010\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"00110011111\", \"expected\": \"00110011111\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"00000000100\", \"expected\": \"000100\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.168,"exit_code":1,"observations":[{"actual":"1001100000010100","check":"regression: trailing character bit width 0","expected":"10011000000010100","passed":false},{"actual":"01100111010101100","check":"repair trap 1","expected":"01100111010101100","passed":true},{"actual":"11000001111111010101000000011100011111","check":"combined fault 2","expected":"110000011111110101010000000111000011111","passed":false},{"actual":"","check":"control 3","expected":"","passed":true},{"actual":"0011100101001000101100","check":"control 4","expected":"0011100101001000101100","passed":true},{"actual":"01110110010","check":"boundary 5","expected":"01110110010","passed":true},{"actual":"00110011111","check":"boundary 6","expected":"00110011111","passed":true},{"actual":"00100","check":"control 7","expected":"000100","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: trailing character bit width 0\", \"actual\": \"1001100000010100\", \"expected\": \"10011000000010100\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"01100111010101100\", \"expected\": \"01100111010101100\", \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": \"11000001111111010101000000011100011111\", \"expected\": \"110000011111110101010000000111000011111\", \"passed\": false}, {\"check\": \"control 3\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"0011100101001000101100\", \"expected\": \"0011100101001000101100\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"01110110010\", \"expected\": \"01110110010\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"00110011111\", \"expected\": \"00110011111\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"00100\", \"expected\": \"000100\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.87,"exit_code":0,"observations":[{"actual":"10011000000010100","check":"regression: trailing character bit width 0","expected":"10011000000010100","passed":true},{"actual":"01100111010101100","check":"repair trap 1","expected":"01100111010101100","passed":true},{"actual":"110000011111110101010000000111000011111","check":"combined fault 2","expected":"110000011111110101010000000111000011111","passed":true},{"actual":"","check":"control 3","expected":"","passed":true},{"actual":"0011100101001000101100","check":"control 4","expected":"0011100101001000101100","passed":true},{"actual":"01110110010","check":"boundary 5","expected":"01110110010","passed":true},{"actual":"00110011111","check":"boundary 6","expected":"00110011111","passed":true},{"actual":"000100","check":"control 7","expected":"000100","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: trailing character bit width 0\", \"actual\": \"10011000000010100\", \"expected\": \"10011000000010100\", \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": \"01100111010101100\", \"expected\": \"01100111010101100\", \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": \"110000011111110101010000000111000011111\", \"expected\": \"110000011111110101010000000111000011111\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"0011100101001000101100\", \"expected\": \"0011100101001000101100\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"01110110010\", \"expected\": \"01110110010\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"00110011111\", \"expected\": \"00110011111\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"000100\", \"expected\": \"000100\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}