From fca03033e4b3a908cc1c349c3e15e2e4d883b749 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 2 Jul 2024 00:50:36 -0400 Subject: a8utf8: removed (replaced by a8cat). --- a8utf8 | 172 ----------------------------------------------------------------- 1 file changed, 172 deletions(-) delete mode 100755 a8utf8 (limited to 'a8utf8') diff --git a/a8utf8 b/a8utf8 deleted file mode 100755 index 0cca2ac..0000000 --- a/a8utf8 +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/perl -w - -# convert A8 text to UTF-8. Control graphics characters are replaced with -# nearest Unicode equivalents (mostly from the box-drawing range, or from -# the basic-latin range with -i option). - -# Careful editing this script: you need an editor that groks UTF-8, or at -# least one that won't mangle the UTF-8 sequences embedded in the tables -# below. - -($SELF = $0) =~ s,.*/,,; - -binmode(STDOUT, ":utf8"); -binmode(STDIN, ":bytes"); - -use utf8; - -%atascii_table = ( - 0 => "♥", - 1 => "┣", - 2 => "┃", - 3 => "┛", - 4 => "┫", - 5 => "┓", - 6 => "╱", - 7 => "╲", - 8 => "◢", - 9 => "▗", - 10 => "◣", - 11 => "▝", - 12 => "▘", - 13 => "▔", - 14 => "▁", - 15 => "▖", - 16 => "♣", - 17 => "┏", - 18 => "━", - 19 => "╋", - 20 => "●", - 21 => "▄", - 22 => "▎", - 23 => "┳", - 24 => "┻", - 25 => "▌", - 26 => "┗", - 27 => "␛", - 28 => "↑", - 29 => "↓", - 30 => "←", - 31 => "→", - 96 => "◆", - 123 => "♠", - 125 => "↰", - 126 => "◀", - 127 => "▶", - 136 => "◤", - 137 => "▛", - 138 => "◥", - 139 => "▙", - 140 => "▟", - 141 => "▆", - 142 => "🮅", - 143 => "▜", - 148 => "◙", - 149 => "▀", - 150 => "🮊", - 153 => "▐", - 155 => "\n", - 156 => "⍐", - 157 => "⍗", - 158 => "⍇", - 159 => "⍈", - 160 => "█", -); - -%xl_intl_table = ( - 0 => "á", - 1 => "ù", - 2 => "Ñ", - 3 => "É", - 4 => "ç", - 5 => "ô", - 6 => "ò", - 7 => "ì", - 8 => "£", - 9 => "ï", - 10 => "ü", - 11 => "ä", - 12 => "Ö", - 13 => "ú", - 14 => "ó", - 15 => "ö", - 16 => "Ü", - 17 => "â", - 18 => "û", - 19 => "î", - 20 => "é", - 21 => "è", - 22 => "ñ", - 23 => "ê", - 24 => "ȧ", - 25 => "à", - 26 => "Ȧ", - 27 => "␛", - 28 => "↑", - 29 => "↓", - 30 => "←", - 31 => "→", - 96 => "¡", - 123 => "Ä", - 126 => "◀", - 127 => "▶", - 155 => "\n", -); - -undef $/; - -$table = \%atascii_table; -$print_table = 0; -while(@ARGV && $ARGV[0] =~ /^-/) { - for($ARGV[0]) { - /^-i$/ && do { $table = \%xl_intl_table; next; }; - /^-t$/ && do { $print_table = 1; next; }; - /^-r$/ && do { $reverse = 1; next; }; - /^--?h/ && do { usage(0) }; - warn "$SELF: unknown option: $_\n"; - usage(1); - } - shift @ARGV; -} - -if($reverse) { - binmode(STDOUT, ":bytes"); - for(keys %$table) { - $revtable{ord($table->{$_})} = chr($_); - } - $table = \%revtable; -} - -if($print_table) { - for(sort { $a <=> $b } keys %$table) { - my $chr = translate(chr $_); - $chr = '\n' if $chr eq "\n"; - printf '"%d","$%02x","%s"' . "\n", $_, $_, $chr; - } - exit 0; -} - -$_ = <>; -s/(.)/translate($1)/seg; -print; - -sub translate { - my $o = ord(shift); - my $ret; - - $ret = $table->{$o}; - return $ret if defined($ret); - - $ret = $table->{$o & 0x7f}; - return $ret if defined($ret); - - return chr($o & 0x7f); -} - -sub usage { - print <