)) {
#s/(=\s)([\x80-\xffff])(?=\s)/display_char($1)/xg;
$line =~ s/([^\x00-\x7f])/display_char($1)/eg;
print $fout $line;
}
select $fout;
$|++;
exit;
sub display_char {
my $char = shift;
my $html_entity = encode_entities($char);
if ($html_entity =~ /^&/ && $html_entity !~ /^/) {
$html_entity = CGI::escapeHTML($html_entity);
} else {
$html_entity = '';
}
my $unicode_block = Unicode::UCD::charblock(ord($char)) || '';
if ($unicode_block) {
(my $block_url = lc($unicode_block)) =~ s/[^A-Z]+/_/gi;
$block_url = "http://www.fileformat.info/info/unicode/block/$block_url/list.htm";
$unicode_block = "$unicode_block";
}
my $unicode_category = Unicode::UCD::charinfo(ord($char)) || '';
if($unicode_category) {
$unicode_category = $unicode_category->{category};
my $category_url = "http://www.fileformat.info/info/unicode/category/$unicode_category/list.htm";
my $category_name = Unicode::UCD::general_categories()->{$unicode_category};
$unicode_category = "$category_name";
}
my $charnum = sprintf("%x", ord($char));
my $descr = "$char"
. (charnames::viacode(ord($char)) || '') . "
$html_entity
$unicode_block
$unicode_category
";
(my $hidden_but_searchable = $descr) =~ s/<.*?>/ /sg;
$descr = CGI::Util::simple_escape($descr);
$descr =~ s/'//g;
#print $fout
return "$hidden_but_searchable
$char
\n";
}
sub header {
print $fout <<'EOF';
Unicode characters
EOF
}
# the "data" section is the template for creating the page
__DATA__
Unicode characters I frequently cut-n-paste.
— §
← ⇐ → ⇒ ⇔
† ‡
⚧
superscript: ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁻
subscript: ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₋
fractions: ½ ¼ ¾ ⅓ ⅔ ⅛ ⅜ ⅝ ⅞
math: ≠ ± ° ∞ × · ∑ ∫ ∬ ≈
greek: Δ θ λ μ ω
box drawing:
just for fun: ☃ ☠ ⍨ ☔ ☕ ⚰
Unicode v6.*, stuff you're unlikely to see in the wild: 💩 🌃 🌄 🌉 🌞 🏩 👙
Ctrl-F to search for a character. <Escape> to clear things from the screen.
If you can't find your character, search
here,
here,
here or here, or
draw here.
Source code here.