4 unless(grep /blib/, @INC) {
14 use charnames ':full';
16 print "not " unless "Here\N{EXCLAMATION MARK}?" eq "Here!?";
20 use bytes; # TEST -utf8 can switch utf8 on
22 print "# \$res=$res \$\@='$@'\nnot "
23 if $res = eval <<'EOE'
24 use charnames ":full";
25 "Here: \N{CYRILLIC SMALL LETTER BE}!";
28 or $@ !~ /above 0xFF/;
30 # print "# \$res=$res \$\@='$@'\n";
32 print "# \$res=$res \$\@='$@'\nnot "
33 if $res = eval <<'EOE'
34 use charnames 'cyrillic';
38 or $@ !~ /CYRILLIC CAPITAL LETTER BE.*above 0xFF/;
42 # If octal representation of unicode char is \0xyzt, then the utf8 is \3xy\2zt
43 if (ord('A') == 65) { # as on ASCII or UTF-8 machines
44 $encoded_be = "\320\261";
45 $encoded_alpha = "\316\261";
46 $encoded_bet = "\327\221";
47 $encoded_deseng = "\360\220\221\215";
49 else { # EBCDIC where UTF-EBCDIC may be used (this may be 1047 specific since
50 # UTF-EBCDIC is codepage specific)
51 $encoded_be = "\270\102\130";
52 $encoded_alpha = "\264\130";
53 $encoded_bet = "\270\125\130";
54 $encoded_deseng = "\336\102\103\124";
62 use charnames ':full';
64 print "not " unless to_bytes("\N{CYRILLIC SMALL LETTER BE}") eq $encoded_be;
67 use charnames qw(cyrillic greek :short);
69 print "not " unless to_bytes("\N{be},\N{alpha},\N{hebrew:bet}")
70 eq "$encoded_be,$encoded_alpha,$encoded_bet";
75 use charnames ':full';
76 print "not " unless "\x{263a}" eq "\N{WHITE SMILING FACE}";
78 print "not " unless length("\x{263a}") == 1;
80 print "not " unless length("\N{WHITE SMILING FACE}") == 1;
82 print "not " unless sprintf("%vx", "\x{263a}") eq "263a";
84 print "not " unless sprintf("%vx", "\N{WHITE SMILING FACE}") eq "263a";
86 print "not " unless sprintf("%vx", "\xFF\N{WHITE SMILING FACE}") eq "ff.263a";
88 print "not " unless sprintf("%vx", "\x{ff}\N{WHITE SMILING FACE}") eq "ff.263a";
93 use charnames qw(:full);
97 my $named = "\N{CUBE ROOT}";
99 print "not " unless ord($x) == ord($named);
104 use charnames qw(:full);
106 print "not " unless "\x{100}\N{CENT SIGN}" eq "\x{100}"."\N{CENT SIGN}";
111 use charnames ':full';
114 unless to_bytes("\N{DESERET SMALL LETTER ENG}") eq $encoded_deseng;
121 no utf8; # naked Latin-1
123 if (ord("Ä") == 0xc4) { # Try to do this only on Latin-1.
124 use charnames ':full';
125 my $text = "\N{LATIN CAPITAL LETTER A WITH DIAERESIS}";
126 print "not " unless $text eq "\xc4" && ord($text) == 0xc4;
129 print "ok 16 # Skip: not Latin-1\n";
134 print "not " unless charnames::viacode(0x1234) eq "ETHIOPIC SYLLABLE SEE";
137 print "not " if defined charnames::viacode(0x0590); # unused Hebrew
143 sprintf "%04X\n", charnames::vianame("GOTHIC LETTER AHSA") eq "10330";
147 defined charnames::vianame("NONE SUCH");
152 # check that caching at least hasn't broken anything
154 print "not " unless charnames::viacode(0x1234) eq "ETHIOPIC SYLLABLE SEE";
158 sprintf "%04X\n", charnames::vianame("GOTHIC LETTER AHSA") eq "10330";
163 print "not " unless "\N{CHARACTER TABULATION}" eq "\t";
166 print "not " unless "\N{ESCAPE}" eq "\e";
169 print "not " unless "\N{NULL}" eq "\c@";
172 # TODO: support 3.1 names, BOM. Generic aliasing?