Description
openedon Dec 17, 2019
We talked about control characters before, and how they are interpreted by the console or the terminal instead of printing characters.
When working in a terminal, it is sometimes helpful to visualize these in-band control sequences, Visual Studio Code even does it when showing files, by showing small "ESC", "SUB",... when the "Render Control Characters" option is enabled.
Unicode got the same idea, and included a block of Control Pictures (U+2400 to U+2426) in Unicode 12.0. These are designed to be able to represent the control characters on a terminal screen:
␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟␠␡␢␣␥␦
(https://en.wikipedia.org/wiki/Control_Pictures)
When available, these can be used by CUI apps to provide a visual representation of these special characters, exactly like Visual Studio Code does.
Adding these 39 glyphs would make it possible for utilities such as hexdump to show them in text representations, which is much more helpful than having 34 of the 256 values show up as generic dots. It would even make it possible to a CUI text editor to provide the "Render Control Characters" option.
Windows Terminal currently falls back to another font to render these, but they are tiny and impractical for use in a terminal.
Below is a sample of a hexdump function showing the contents of cmd.exe with high-ascii and control characters (using the font fallback):
And the Ubuntu hexdump command showing the same file, with dots for high-ascii and control characters (so only 96 values out of 256 provide chars representations). (this one is not using Cascadia, but shows the limitation when these characters are not available).