Html({
title => 'charset cheat sheet',
- version => '1.0',
+ version => '1.1',
description => [
"Reference sheet with all glyphs in common character encoding tables,",
"and an overview of Unicode ranges and UTF-8 bytes.",
say "Charset comparison:";
}
-sub optionlink {
- my ($title, $href, $selected) = @_;
- return sprintf(
- $selected ? '<strong>%s</strong>' : '<a href="%2$s">%s</a>',
- EscapeHTML($title), $href
- );
-}
-
print join " •\n", (
map {
join " ·\n", pairmap {
- optionlink($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request);
+ showlink($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request);
} @{$_}
}
[
}
$row{endpoint} ||= 0xFF;
- if ($row{set}) {}
+ if (defined $row{table} or defined $row{cell}) {
+ $row{set} //= $input;
+ }
elsif ($row{set} = Encode::resolve_alias($input)) {
$row{offset} = delete $row{startpoint};
- if ($row{set} eq 'MacHebrew' or $row{set} eq 'MacThai') {
+ if ($charset->{varchar}) {
# array of possibly multiple characters per code point
$row{table} = [
map { Encode::decode($row{set}, pack 'C*', $_) } $row{offset} .. $row{endpoint}
}
$row{endpoint} -= $row{offset};
-
- $visible->{ascii} = # assume common base
- $visible->{ $row{set} } = 1;
+ $visible->{ascii}++; # assume common base
}
else {
Alert("Encoding <q>$input</q> unknown");
}
push @request, \%row;
+ $visible->{ $row{set} } = 1 if $row{table};
}
tabinput($_) for @tablist;
my $cp = $offset + $row->{offset};
my $glyph = ref $row->{table} eq 'ARRAY' ? $row->{table}->[$offset] :
substr $row->{table}, $offset, 1;
- my ($cell, $name, $class) = $glyph eq $NOCHAR ? () :
+ my ($cell, $name, $class) = !defined $glyph || $glyph eq $NOCHAR ? () :
$glyphs->glyph_html($glyph);
if ($mode) {