From dc5cf0bc49059d2cd55f727e66f7d9f5133ee7f9 Mon Sep 17 00:00:00 2001 From: WatchTree-19 <119982314+WatchTree-19@users.noreply.github.com> Date: Mon, 27 Jul 2026 15:19:32 +0100 Subject: [PATCH] encoding: braille semicolon mapped to the wrong cell The braille() encoder mapped ';' to U+2830 (dots 5,6), which is the letter-sign / grade-1 indicator cell, not a semicolon. English Braille -- and UEB, and the French and German codes -- all encode the semicolon as dots 2,3 = U+2806. Every other punctuation mark in the map already follows that standard (comma dot 2, colon dots 2,5, period dots 2,5,6, ...), so this was an isolated transcription error, not a code-variant choice. Effect: any ';' in a payload was braille-encoded to the wrong character. Added test_braille_punctuation_cells, which pins the exact cell for each punctuation mark; it fails on the old value (';' -> U+2830) and passes on U+2806. Signed-off-by: WatchTree-19 <119982314+WatchTree-19@users.noreply.github.com> --- garak/probes/encoding.py | 2 +- tests/probes/test_probes_encoding.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/garak/probes/encoding.py b/garak/probes/encoding.py index f6f6e1910..c1afd6208 100644 --- a/garak/probes/encoding.py +++ b/garak/probes/encoding.py @@ -97,7 +97,7 @@ def braille(text): "?": "\u2826", "$": "\u2832", ":": "\u2812", - ";": "\u2830", + ";": "\u2806", "(": "\u2836", ")": "\u2836", "1": "\u2801", diff --git a/tests/probes/test_probes_encoding.py b/tests/probes/test_probes_encoding.py index 663f93ae7..d62c3c568 100644 --- a/tests/probes/test_probes_encoding.py +++ b/tests/probes/test_probes_encoding.py @@ -91,3 +91,25 @@ def test_atbash_function(plain, expected): encoder = InjectAtbash.atbash # staticmethod reference result = encoder(plain.encode()).decode() assert result == expected + + +def test_braille_punctuation_cells(): + """Braille encoder must use the correct English/UEB cells for punctuation. + + Regression for the semicolon, which was mapped to U+2830 (dots 5,6, the + letter-sign cell) instead of the semicolon cell U+2806 (dots 2,3). Every + other punctuation mark in the map already follows the standard, so this was + an isolated transcription error. + """ + expected = { + b",": "⠂", # dot 2 + b";": "⠆", # dots 2,3 + b":": "⠒", # dots 2,5 + b".": "⠲", # dots 2,5,6 + b"!": "⠖", # dots 2,3,5 + b"?": "⠦", # dots 2,3,6 + } + for char, cell in expected.items(): + assert ( + garak.probes.encoding.braille(char).decode() == cell + ), f"{char!r} encoded to the wrong braille cell"