|
Revision 1913, 1.1 kB
(checked in by karpet, 1 year ago)
|
for all the world to see
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
use strict; |
|---|
| 4 |
use warnings; |
|---|
| 5 |
|
|---|
| 6 |
use POSIX qw(locale_h); |
|---|
| 7 |
use locale; |
|---|
| 8 |
use Encode; |
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
my %c = ( |
|---|
| 15 |
'32' => 'space', |
|---|
| 16 |
'40000' => 'chinese char', |
|---|
| 17 |
'90' => 'Latin Z', |
|---|
| 18 |
'160' => 'nbsp', |
|---|
| 19 |
'171' => 'left arrow', |
|---|
| 20 |
'95' => 'underscore', |
|---|
| 21 |
'224' => 'a with grave accent', |
|---|
| 22 |
'97' => 'Latin a plus grave accent combining mark (2 bytes)' |
|---|
| 23 |
); |
|---|
| 24 |
|
|---|
| 25 |
binmode STDOUT, ":utf8"; |
|---|
| 26 |
|
|---|
| 27 |
my $slashw = qr/^\w$/; |
|---|
| 28 |
my $slashp = qr/^(\p{L}\p{M}*)$/; |
|---|
| 29 |
|
|---|
| 30 |
for my $n (sort { $a <=> $b } keys %c) |
|---|
| 31 |
{ |
|---|
| 32 |
my $c = chr($n); |
|---|
| 33 |
if ($n == 97) |
|---|
| 34 |
{ |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
$c .= chr(768); |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
print "$c ($c{$n})\n"; |
|---|
| 41 |
print "\t", $slashw, ' = '; |
|---|
| 42 |
print $c =~ m/$slashw/ ? 1 : 0; |
|---|
| 43 |
print "\n"; |
|---|
| 44 |
print "\t", $slashp, ' = '; |
|---|
| 45 |
print $c =~ m/$slashp/ ? 1 : 0; |
|---|
| 46 |
print "\n\tUTF8 = "; |
|---|
| 47 |
print Encode::is_utf8($c) ? 1 : 0; |
|---|
| 48 |
print "\n"; |
|---|
| 49 |
} |
|---|