Bytes as Braille
7 hours ago
- #Python
- #Braille
- #Bytestrings
- The author works with bytestrings in Python3, some of which decode as ASCII or UTF strings, while others do not.
- Displaying undecodable bytestrings as-is is inconvenient, especially with Unicode symbols that don't render correctly.
- A function was initially written to decode bytestrings and return 'bytes' if undecodable, but this approach lost information and made it hard to distinguish between different undecodable bytestrings.
- Braille symbols were identified as a workaround for displaying bytestrings more compactly and legibly, despite their unconventional ordering in Unicode.
- Braille has historical significance as a precursor to Unicode, with unique features like prefix symbols for numbers and language-specific dialects.
- The author reordered Braille cells based on byte values rather than Unicode numbers, improving the display of bytestrings.
- The new method allows for colored output to highlight specific bytes, making patterns in binary data more visible.
- The script for this Braille-based bytestring display is available on GitHub.