From MAILER-DAEMON Sun Jun 10 21:31:39 2007
Date: 10 Jun 2007 21:31:39 -0400
From: Mail System Internal Data <MAILER-DAEMON@turing.acm.org>
Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
X-IMAP: 1181525499 0000000000
Status: RO

This text is part of the internal format of your mail folder, and is not
a real message.  It is created automatically by the mail system software.
If deleted, important folder data will be lost, and it will be re-created
with the data reset to initial values.

From perlman@linuxdev1.dev.oclc.org  Sun Jun 10 21:30:58 2007
Return-Path: <perlman@linuxdev1.dev.oclc.org>
Received: from acm26-4.acm.org (acm26-4.acm.org [63.118.7.109])
	by turing.acm.org (8.13.1/8.13.1) with ESMTP id l5B1UwC8009545
	for <perlman@turing.acm.org>; Sun, 10 Jun 2007 21:30:58 -0400
Received: from psmtp.com ([64.18.2.82])
        by acm26-4.acm.org (ACM Email Forwarding Service) with SMTP id QHP18758
        for <perlman@acm.org>; Sun, 10 Jun 2007 21:30:58 -0400
Received: from source ([132.174.29.209]) by exprod7mx80.postini.com ([64.18.6.14]) with SMTP;
	Sun, 10 Jun 2007 21:30:57 EDT
Received: From linuxdev1.dev.oclc.org ([132.174.113.17]) by mshieldserver1.oclc.org (WebShield SMTP v4.5 MR2);
	id 118152545646; Sun, 10 Jun 2007 21:30:56 -0400
Received: by linuxdev1.dev.oclc.org (Postfix, from userid 3284)
	id 580826C1D0; Sun, 10 Jun 2007 21:30:55 -0400 (EDT)
To: perlman@acm.org
Message-Id: <20070611013055.580826C1D0@linuxdev1.dev.oclc.org>
Date: Sun, 10 Jun 2007 21:30:55 -0400 (EDT)
From: perlman@linuxdev1.dev.oclc.org (Gary PERLMAN)
X-pstn-levels:     (S:35.64138/99.90000 P:95.9108 M:97.0282 C:98.6951 )
X-pstn-settings: 3 (1.0000:1.0000) s gt3 gt2 gt1 p m c 
X-pstn-addresses: from <perlman@linuxdev1.dev.oclc.org> forward (user good) [177/9] 
Status: R
X-Status: 
X-Keywords:                  

#! /usr/local/bin/perl

# This script prints a table of characters in several formats.

$low = ($ARGV[0] ? $ARGV[0] : 0);
$high = ($ARGV[1] ? $ARGV[1] : 255);

@name = ("NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
	"BS", "HT", "NL", "VT", "NP", "CR", "SO", "SI",
	"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
	"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US", "SP");
$name[127] = "DEL";

# print the header
print "Dec\tOct\tHex\tChr\tMaRC\tSym\n";

sub marc
{
	local ($marc) = "_abcdefghijklmnopqrstuvwxyz0123456789";
	local ($n) = (@_);
	if ($n > 0 && $n <= 36) {
		return substr ($marc, $n, 1);
	} elsif ($n > 36 && $n <= 50) {
		return $n;
	}
}

for $i ($low .. $high) {
	printf "%d\t%o\t%X\t", $i, $i, $i;
	if ($i < 32) {
		printf "^%c",  ord('A')+$i-1;
	} else {
		printf "%c", $i;
	}
	print "\t", marc($i);
	if ($name[$i]) {
		print ("\t$name[$i]");
	} else {
		print "\t";
	}
	if ($i >= 0x80) {
		uni2utf8($i);
	}
	print "\n";
}

#for $i (128 .. $high) {
	#printf "%c", $i;
#}
#print "\n";

# http://czyborra.com/utf/
sub uni2utf8
{
	local ($c) = (@_);
	local ($d);
	if ($c < 0x80) { # 0 .. 127
		printf "%d=%c", $c, $c;
	} elsif ($c < 0x800) { # 128 .. 2047
		printf "%d=%c ", $d = (0xC0 | $c>>6), $d;
		printf "%d=%c ", $d = (0x80 | $c & 0x3F), $d;
	} elsif ($c < 0x10000) { # 2048 .. 
		printf "%c", (0xE0 | $c>>12);
		printf "%c", (0x80 | $c>>6 & 0x3F);
		printf "%c", (0x80 | $c & 0x3F);
	} elsif ($c < 0x200000) { # 2,097,152 ..
		printf "%c", (0xF0 | $c>>18);
		printf "%c", (0x80 | $c>>12 & 0x3F);
		printf "%c", (0x80 | $c>>6 & 0x3F);
		printf "%c", (0x80 | $c & 0x3F);
	}
}

