git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
htaccess: align rewrite configuration arguments
[sheet.git]
/
charset.plp
diff --git
a/charset.plp
b/charset.plp
index 5b415eec8387bb6cf6b76e81f7ae3c52d9093f5e..d8527f01ff307bc5a80abfe4db1959ec7b0f409b 100644
(file)
--- a/
charset.plp
+++ b/
charset.plp
@@
-5,7
+5,7
@@
my @tablist = split m{/+}, $Request || 'default';
Html({
title => 'charset cheat sheet',
Html({
title => 'charset cheat sheet',
- version => '1.
0
',
+ version => '1.
2
',
description => [
"Reference sheet with all glyphs in common character encoding tables,",
"and an overview of Unicode ranges and UTF-8 bytes.",
description => [
"Reference sheet with all glyphs in common character encoding tables,",
"and an overview of Unicode ranges and UTF-8 bytes.",
@@
-14,7
+14,7
@@
Html({
charset codepage unicode ascii utf8 latin glyph character encoding
reference common overview table
'],
charset codepage unicode ascii utf8 latin glyph character encoding
reference common overview table
'],
-
stylesheet => [qw'light']
,
+
(stylesheet => [qw'light']) x !$mode
,
data => [qw(
charset-encoding.inc.pl
charset-unicode.inc.pl charset-ucplanes.inc.pl charset-utf8.inc.pl
data => [qw(
charset-encoding.inc.pl
charset-unicode.inc.pl charset-ucplanes.inc.pl charset-utf8.inc.pl
@@
-28,26
+28,25
@@
use List::Util qw( first pairmap pairfirst pairs );
<p>
<:
<p>
<:
+if ($tablist[0] eq 'unicode') {
+ say "Detailed allocation of Unicode blocks.";
+ print "See ", showlink("charsets", '/charset'), " to compare specific encodings";
+}
+else {
+
if ($tablist[0] eq 'default') {
if ($tablist[0] eq 'default') {
- say "Overview of Unicode allocation and common latin code pages.";
+ say "Overview of Unicode ", showlink("allocation", '/charset/unicode');
+ say "and common latin code pages.";
say "Compare alternate charsets:";
}
else {
say "Charset comparison:";
}
say "Compare alternate charsets:";
}
else {
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 {
print join " •\n", (
map {
join " ·\n", pairmap {
-
option
link($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request);
+
show
link($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request);
} @{$_}
}
[
} @{$_}
}
[
@@
-68,6
+67,8
@@
print join " •\n", (
hebrew => 0,
],
);
hebrew => 0,
],
);
+
+}
:>.
</p>
:>.
</p>
@@
-149,10
+150,12
@@
sub tabinput {
}
$row{endpoint} ||= 0xFF;
}
$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};
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}
# array of possibly multiple characters per code point
$row{table} = [
map { Encode::decode($row{set}, pack 'C*', $_) } $row{offset} .. $row{endpoint}
@@
-165,9
+168,7
@@
sub tabinput {
}
$row{endpoint} -= $row{offset};
}
$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");
}
else {
Alert("Encoding <q>$input</q> unknown");
@@
-178,6
+179,12
@@
sub tabinput {
while (my ($offset, $sub) = each %{$replace}) {
$offset -= $row{offset};
while (my ($offset, $sub) = each %{$replace}) {
$offset -= $row{offset};
+ if (ref $row{table} eq 'ARRAY') {
+ $row{table}->[$offset] = $sub
+ if $offset >= 0 and $offset <= $row{endpoint};
+ next;
+ }
+
my $length = length $sub;
if ($offset < 0) {
my $length = length $sub;
if ($offset < 0) {
@@
-200,6
+207,7
@@
sub tabinput {
}
push @request, \%row;
}
push @request, \%row;
+ $visible->{ $row{set} } = 1 if $row{table};
}
tabinput($_) for @tablist;
}
tabinput($_) for @tablist;
@@
-323,7
+331,7
@@
for my $row (@request) {
my $cp = $offset + $row->{offset};
my $glyph = ref $row->{table} eq 'ARRAY' ? $row->{table}->[$offset] :
substr $row->{table}, $offset, 1;
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) {
$glyphs->glyph_html($glyph);
if ($mode) {
@@
-339,8
+347,8
@@
for my $row (@request) {
$visible->{$glyph}++;
}
$visible->{$glyph}++;
}
- say sprintf $class ? '<td title="%s" class="X %s">%s' : '<td title="%s">',
-
$name, $class, $cell
;
+ print '<td title="%s"', $name;
+
say $class ? sprintf(' class="X %s">%s', $class, $cell) : '>'
;
}
continue {
$offset += $colsize;
}
continue {
$offset += $colsize;
@@
-391,7
+399,7
@@
for my $row (@request) {
</table>
<table class="glyphs"><tr>
</table>
<table class="glyphs"><tr>
- <td class="X">unicode
7
.0
+ <td class="X">unicode
10
.0
<td class="X Xr">proposed
<td class="X Xd">deprecated
<td class="">unassigned
<td class="X Xr">proposed
<td class="X Xd">deprecated
<td class="">unassigned