Anbei ein cleiner Unicode Viewer für den Webbetrieb.
Er zeigt über das Modul Unicode::UCD einige Informationen an, die in einer Charmap sonst fehlen.
Code steht zur allgemeinen Verfügung.
#!perl -C7
use warnings;
use strict;
use constant { NL => "\n"};
BEGIN {
use CGI::Carp qw(carpout fatalsToBrowser);
open(LOG, ">","error.txt") or die "Unable to append to error.txt: $!\n";
carpout(*LOG);
}
use Unicode::CharName qw(uname ublock);
use Unicode::UCD 'charinfo';
my %User = (
blockstart=>0,
blockend=>1,
);
for( $ENV{QUERY_STRING} ){
/blockstart=(\d+)/ and $User{blockstart} = $1;
/blockend=(\d+)/ and $User{blockend} = $1;
}
print "Content-type: text/html; charset=utf-8\n\n",
q(<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">),
'<html><head>',
'<style>
body{font-size:16px; font-face: "DejaVu Sans", Junicode, Arial, sans-serif;}
table{ margin:0em; table-layout;fixed; border-collapse:collapse;}
th {font-size:18px; border:1px solid #bbb; background:#eee;}
td {font-size:20px; line-height:1.5; width:2em; text-align:center; border:1px solid #bbb;}
td i {display:none; position:fixed; top:0; right:0; width:20em; background:#eee; padding: 6px;
font-size:14px; font-style:normal; text-align:left;}
td i b {float:left; font-size:60px; width:2em;}
td:hover i {display:block;}
',NL,
'</style>',NL,
'</head><body>',NL,
'<form action="" method="get">',NL,
'Block von <input type="text" name="blockstart" value="',($User{blockstart}),'">',NL,
' bis <input type="text" name="blockend" value="',($User{blockend}),'">',NL,
'<input type="submit" value=" Abfrage "></form>',NL,
'<h1>Unicode Codepoints</h1>';
for my $x ( $User{blockstart}..$User{blockend} ){
#next if $x =~/^(8|15|27|171|21[6-9]|22[0-3])$/;
print '<h2>',$x,'</h2>',NL;
print "<table>";
print "<tr><th>", sprintf("%x",$x * 256) ,"</th>";
for ( 0..15 ){
printf("<th>%x</th>",$_);
}
print '</tr>';
for my $y ( 0..15 ){
printf( "<tr><th>%x</th>", $x * 256 + $y * 16);
for my $z ( 0..15 ){
my $c = $x * 256 + $y * 16 + $z;
my $ci = charinfo($c);
#print '<td title="U+',sprintf("%x",$c),'; ', uname($c),'; ', ublock($c),'">',
print '<td>', chr( $c ),
'<i><b>',chr( $c ),'</b>Nr: U+', sprintf("%x",$c),
'<br>cat: ', $ci->{category},
'<br>comb: ', $ci->{combining},
'<br>decomp: ', $ci->{decomposition},
'<br>script: ', $ci->{script},
'<br>', $ci->{name},
'</i></td>';
}
print "</tr>";
}
print "</table>",NL;
}
print "</body></html>";
exit;
mfg Beat
--
><o(((°> ><o(((°>
<°)))o>< ><o(((°>o
Der Valigator leibt diese Fische
><o(((°> ><o(((°>
<°)))o>< ><o(((°>o
Der Valigator leibt diese Fische