peknet :: an eddy in the bit stream         
about peknet
peknet is Peter E Karman musing on technology, politics, religion, books, beer and parenthood.

navigate

credits

Brighter Planet's 350 Challenge

St Paul Minnesota Yellow Pages

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


Past entries: 2004 . 2005 . 2006 . 2007 . 2008 . 2009 . 2010 . 2011 . 2012 .