peknet :: an eddy in the bit stream         
about peknet


peknet is Peter E Karman. you'll find here musings on technology, politics, religion, books, beer and frequent references to my beautiful sons.

navigate

credits

Powered by Swish-e

Valid CSS!

proud member of the
Open Source Community

© 2005 peknet dot com

syndicate this site

Characters script

Inspired by Simon Cozens' secret software idea, here's a script in my ~/bin dir that I use often. It prints all the glyphs and decimal equivalents for ASCII and any other UTF8 range you specify. I find it especially useful for writing XML/HTML when I want to specify a numerical entity value.

#!/usr/bin/perl # # Copyright 2005 perl@peknet.com # Released under the Free Beer License # # # print chart of chars and matching nums # just latin1 by default # otherwise, specify start/stop numerals at cmd line # # NOTE the ANSI color stuff is unused

use strict; use warnings; use Term::ANSIColor; binmode STDOUT, ':utf8'; print ' '; my $on = color('bold'); my $off = color('reset'); my $c = 0; my $start = shift @ARGV || 161; my $stop = shift @ARGV || 255; for (33 .. 126, $start .. $stop) { my $n = $_; if ($_ < 100) { $n = " $n"; } print("$n ", chr($_), ' '); if (++$c == 6) { print "\n "; $c = 0; } } print "\n";

File under projects Sun Jun 11 22:35:57 CT 2006


2008 entries » 2007 entries » 2006 entries » 2005 entries » 2004 entries »
« July  August 2008  Sept »
Sun Mon Tue Wed Thu Fri Sat
         
           
weather
Saint Paul, MN
68 F (20 C)
Fair

Sunrise/Sunset
Updated:
Aug 28, 10:53 pm CDT

worth reading