X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/a0ba9298856b2426c5c66b6d2f2b284d98cee594..1f2a2817298b6951e63bb73125f35a47542e0834:/charset.plp diff --git a/charset.plp b/charset.plp index c9ef2b6..e5fdd45 100644 --- a/charset.plp +++ b/charset.plp @@ -1,185 +1,174 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; - -our $VERSION = '1.0'; - -$header{content_type} = 'text/html; charset=utf-8'; - -:> - +<(common.inc.plp)><: + +Html({ + title => 'charset cheat sheet', + version => 'v1.0', + description => [ + "Reference sheet with all glyphs in common character encoding tables,", + "and an overview of Unicode ranges and UTF-8 bytes.", + ], + keywords => [qw' + charset codepage unicode ascii utf8 latin glyph character encoding + reference common overview table + '], + stylesheet => [qw'light'], +}); -
-Encoding $input unknown
\n"; + } + \%row; + } + else { + (); + } +} map { defined $ALIAS{$_} ? @{ $ALIAS{$_} } : $_ } + $ENV{PATH_INFO} =~ /\w/ ? split(m{[/+\s]}, $ENV{PATH_INFO}) : 'default'; my $NOCHAR = chr 0xFFFD; -for my $cp437 (grep {$request[$_] eq 'cp437'} 0 .. $#request) { - substr($tables[$cp437], 237, 1) = pack 'U*', 0x3D5; # phi sign - substr($tables[$cp437], 0, 32) = pack 'U*', map {hex} qw( +for my $cp437 (grep {$request[$_]->{set} eq 'cp437'} 0 .. $#request) { + substr($request[$cp437]->{table}, 237, 1) = pack 'U*', 0x3D5; # phi sign + substr($request[$cp437]->{table}, 0, 32) = pack 'U*', map {hex} qw( 2007 263A 263B 2665 2666 2663 2660 2022 25D8 25CB 25D9 2642 2640 266A 266B 263C 25BA 25C4 2195 203C 00B6 00A7 25AC 21A8 2191 2193 2192 2190 221F 2194 25B2 25BC ); } -sub quote { - local $_ = shift; - s/"/"/g; - s/</g; - s/>/>/g; - return $_; -} - -print "â±"; print ' | ', $_ for @nibble; print "\n"; } print ' | |
---|---|---|
', $nibble[$msb]; + for my $msb (0 .. (length($row->{table}) || 256) - 1 >> 4) { + printf ' | ||
%X', $msb + ($row->{offset} >> 4); for my $lsb (0 .. $#nibble) { - my $glyph = substr $tables[$tablenum], ($msb<<4) + $lsb, 1; + if ($row->{cell}) { + print $row->{cell}->(($msb<<4) + $lsb); + next; + } + + my $glyph = substr $row->{table}, ($msb<<4) + $lsb, 1; if ($glyph eq $NOCHAR) { print ' | '; next; } - my $info = [ord $glyph]; - if (defined (my $mnem = $di{ord $glyph})) { - $info = $diinfo->{$mnem}; - } - my ($codepoint, $name, $prop, $script, $string) = @$info; - $glyph = quote($string || $glyph); - my $desc = sprintf 'U+%04X%s', $codepoint, $name && " ($name)"; - my @class = ('X', grep {$_} $prop, $script); - - $glyph = "$glyph" if $prop eq 'Zs'; - - printf "\n".' | %s', - join(' ', @class), quote($desc), $glyph; + print "\n".$glyphs->glyph_cell($glyph); } print "\n"; } - print " |
â±"; - print ' | ', $_ for @nibble; - print "\n"; - } - print ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
', $nibble[$msb]; - for my $lsb (0 .. $#nibble) { - my $value = ($msb<<4) + $lsb; - if ($value <= 0x7F) { - print ' | Single byte ASCII' - if $value == 0; - } - elsif ($value <= 0xBF) { - print ' | Multi-byte continuation' - if $value == 0x80; - } - elsif ($value <= 0xC1) { - print ' | (Overl.)' - if $value == 0xC0; - } - elsif ($value <= 0xDF) { - print ' | 2-byte sequence start' - if $value == 0xC2; - print ' | ' - if $value == 0xD0; - } - elsif ($value <= 0xEF) { - print ' | 3-byte sequence start' - if $value == 0xE0; - } - elsif ($value <= 0xF4) { - print ' | 4-byte sequence' - if $value == 0xF0; - } - elsif ($value <= 0xF7) { - print ' | (Overflow)' - if $value == 0xF5; - } - elsif ($value <= 0xFB) { - print ' | 5-byte' - if $value == 0xF8; - } - elsif ($value <= 0xFD) { - print ' | 6-byte' - if $value == 0xFC; - } - elsif ($value <= 0xFF) { - print ' | Invalid' - if $value == 0xFE; - } - else { - print "\n".' | ?'; - } - } - print "\n"; - } - print " |
control + | whitespace + | diacritic
| punctuation
| symbol
| numeric + | greek
| aramaic
| syllabic
| alphabetic + |
unicode 5.0 + | proposed + | deprecated + | unassigned + | invalid + |