Sometimes the Mark I Eyeball is still the best tool. It is useful to be able to see problems with unprintable characters. The various line endings, old databases with now-uncommon delimiters, escape sequences of all kinds, strings like that all are peppered with unprintable ASCII characters. When problems arise, we need to see what's there. The usual solution is an eye-crossing hex dump with man ascii open in another terminal.
The old DEC VT-x terminals had a lovely solution. A terminal mode was available which printed ASCII control characters as single-character representations of their ASCII names. For instance tab, "\t", has the official name 'HT', for "Horizontal Tab". The DEC control font represents that as a miniature HT.
Moved by japhy's recent discussion, I was browsing the unicode character list. There amongst the math and the exotic languages, I found that DEC's control character set has a home at code point 2400, "Control Pictures". A light came on.
Here's a demo. I'll use HTML::Entities to make the result browser friendly.
That's rendered by your browser as:#!/usr/bin/perl use strict; use warnings; use HTML::Entities; $_ = "\0foo\tbar\tbaz\r\n\a"; tr/\x00-\x1f\x7f/\x{2400}-\x{241f}\x{2421}/; print encode_entities $_; __END__ ␀foo␉bar␉baz␍␊␇
␀foo␉bar␉baz␍␊␇
(assuming your unicode fonts have these characters). Of course this is much more interesting in a unicode-enabled terminal, but that is a whole different problem.
Added: graff, I don't recall seeing extended control characters on VT-100, either. The unicode list has those control characters themselves, with names like "START OF GUARDED AREA", "END OF GUARDED AREA", "STRING TERMINATOR", and the frightening "OPERATING SYSTEM COMMAND". I have seen no hint of Control Pictures for them.
More Added: There is room for extended control characters. The range of Control Pictures is 2400-243F, but only a few characters are assigned in the upper half of that range. They are 2420 ␠ (SPACE), 2421 ␡ (DELETE), 2422 ␢ (BLANK), 2423 ␣ (OPEN BOX), 2424  (NEWLINE), 2425 ␥ (DELETE FORM TWO), 2426 ␦ (SUBSTITUTE FORM TWO). The NEWLINE character would serve nicely for NEXT LINE. The rest don't seem to correspond. I suppose the unicode group would consider designs for the missing symbols. Who uses the extended control characters? Are they part of some standard, ISO-8859 maybe?
After Compline,
Zaxo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Printing the Unprintable
by hv (Prior) on May 20, 2004 at 10:14 UTC | |
Re: Printing the Unprintable
by graff (Chancellor) on May 20, 2004 at 05:45 UTC | |
Re: Printing the Unprintable
by japhy (Canon) on May 20, 2004 at 14:15 UTC |