4 unless(grep /blib/, @INC) {
13 use charnames ':full';
15 print "not " unless "Here\N{EXCLAMATION MARK}?" eq "Here\041?";
19 use bytes; # TEST -utf8 can switch utf8 on
21 print "# \$res=$res \$\@='$@'\nnot "
22 if $res = eval <<'EOE'
23 use charnames ":full";
24 "Here: \N{CYRILLIC SMALL LETTER BE}!";
27 or $@ !~ /above 0xFF/;
29 # print "# \$res=$res \$\@='$@'\n";
31 print "# \$res=$res \$\@='$@'\nnot "
32 if $res = eval <<'EOE'
33 use charnames 'cyrillic';
37 or $@ !~ /CYRILLIC CAPITAL LETTER BE.*above 0xFF/;
41 # If octal representation of unicode char is \0xyzt, then the utf8 is \3xy\2zt
42 if (ord('A') == 65) { # as on ASCII or UTF-8 machines
43 $encoded_be = "\320\261";
44 $encoded_alpha = "\316\261";
45 $encoded_bet = "\327\221";
46 $encoded_deseng = "\360\220\221\215";
48 else { # EBCDIC where UTF-EBCDIC may be used (this may be 1047 specific since
49 # UTF-EBCDIC is codepage specific)
50 $encoded_be = "\270\102\130";
51 $encoded_alpha = "\264\130";
52 $encoded_bet = "\270\125\130";
53 $encoded_deseng = "\336\102\103\124";
61 use charnames ':full';
63 print "not " unless to_bytes("\N{CYRILLIC SMALL LETTER BE}") eq $encoded_be;
66 use charnames qw(cyrillic greek :short);
68 print "not " unless to_bytes("\N{be},\N{alpha},\N{hebrew:bet}")
69 eq "$encoded_be,$encoded_alpha,$encoded_bet";
74 use charnames ':full';
75 print "not " unless "\x{263a}" eq "\N{WHITE SMILING FACE}";
77 print "not " unless length("\x{263a}") == 1;
79 print "not " unless length("\N{WHITE SMILING FACE}") == 1;
81 print "not " unless sprintf("%vx", "\x{263a}") eq "263a";
83 print "not " unless sprintf("%vx", "\N{WHITE SMILING FACE}") eq "263a";
85 print "not " unless sprintf("%vx", "\xFF\N{WHITE SMILING FACE}") eq "ff.263a";
87 print "not " unless sprintf("%vx", "\x{ff}\N{WHITE SMILING FACE}") eq "ff.263a";
92 use charnames qw(:full);
96 my $named = "\N{CUBE ROOT}";
98 print "not " unless ord($x) == ord($named);
103 use charnames qw(:full);
105 print "not " unless "\x{100}\N{CENT SIGN}" eq "\x{100}"."\N{CENT SIGN}";
110 use charnames ':full';
113 unless to_bytes("\N{DESERET SMALL LETTER ENG}") eq $encoded_deseng;
120 no utf8; # naked Latin-1
122 if (ord("Ä") == 0xc4) { # Try to do this only on Latin-1.
123 use charnames ':full';
124 my $text = "\N{LATIN CAPITAL LETTER A WITH DIAERESIS}";
125 print "not " unless $text eq "\xc4" && ord($text) == 0xc4;
128 print "ok 16 # Skip: not Latin-1\n";
133 print "not " unless charnames::viacode(0x1234) eq "ETHIOPIC SYLLABLE SEE";
136 print "not " if defined charnames::viacode(0x0590); # unused Hebrew
142 sprintf "%04X\n", charnames::vianame("GOTHIC LETTER AHSA") eq "10330";
146 defined charnames::vianame("NONE SUCH");