Commit | Line | Data |
---|---|---|
a72c7584 | 1 | print "1..19\n"; |
0a378802 JH |
2 | |
3 | use encoding "latin1"; # ignored (overwritten by the next line) | |
f14ed3c6 | 4 | use encoding "greek"; # iso 8859-7 (no "latin" alias, surprise...) |
0a378802 | 5 | |
0a378802 | 6 | # "greek" is "ISO 8859-7", and \xDF in ISO 8859-7 is |
f14ed3c6 | 7 | # \x{3AF} in Unicode (GREEK SMALL LETTER IOTA WITH TONOS), |
0a378802 JH |
8 | # instead of \xDF in Unicode (LATIN SMALL LETTER SHARP S) |
9 | ||
9f4817db JH |
10 | $a = "\xDF"; |
11 | $b = "\x{100}"; | |
12 | ||
13 | print "not " unless ord($a) == 0x3af; | |
0a378802 JH |
14 | print "ok 1\n"; |
15 | ||
9f4817db | 16 | print "not " unless ord($b) == 0x100; |
0a378802 JH |
17 | print "ok 2\n"; |
18 | ||
9f4817db JH |
19 | my $c; |
20 | ||
21 | $c = $a . $b; | |
22 | ||
23 | print "not " unless ord($c) == 0x3af; | |
0a378802 JH |
24 | print "ok 3\n"; |
25 | ||
9f4817db JH |
26 | print "not " unless length($c) == 2; |
27 | print "ok 4\n"; | |
28 | ||
29 | print "not " unless ord(substr($c, 1, 1)) == 0x100; | |
30 | print "ok 5\n"; | |
0a378802 | 31 | |
121910a4 JH |
32 | print "not " unless ord(chr(0xdf)) == 0x3af; # spooky |
33 | print "ok 6\n"; | |
34 | ||
35 | print "not " unless ord(pack("C", 0xdf)) == 0x3af; | |
36 | print "ok 7\n"; | |
37 | ||
38 | # we didn't break pack/unpack, I hope | |
39 | ||
40 | print "not " unless unpack("C", pack("C", 0xdf)) == 0xdf; | |
41 | print "ok 8\n"; | |
42 | ||
43 | # the first octet of UTF-8 encoded 0x3af | |
44 | print "not " unless unpack("C", chr(0xdf)) == 0xce; | |
45 | print "ok 9\n"; | |
bfa383d6 | 46 | |
3de8ed06 JH |
47 | print "not " unless unpack("U", pack("U", 0xdf)) == 0xdf; |
48 | print "ok 10\n"; | |
49 | ||
50 | print "not " unless unpack("U", chr(0xdf)) == 0x3af; | |
51 | print "ok 11\n"; | |
52 | ||
bfa383d6 JH |
53 | # charnames must still work |
54 | use charnames ':full'; | |
55 | print "not " unless ord("\N{LATIN SMALL LETTER SHARP S}") == 0xdf; | |
3de8ed06 JH |
56 | print "ok 12\n"; |
57 | ||
58 | # combine | |
59 | ||
60 | $c = "\xDF\N{LATIN SMALL LETTER SHARP S}" . chr(0xdf); | |
61 | ||
62 | print "not " unless ord($c) == 0x3af; | |
63 | print "ok 13\n"; | |
64 | ||
65 | print "not " unless ord(substr($c, 1, 1)) == 0xdf; | |
66 | print "ok 14\n"; | |
67 | ||
68 | print "not " unless ord(substr($c, 2, 1)) == 0x3af; | |
69 | print "ok 15\n"; | |
bfa383d6 | 70 | |
a72c7584 JH |
71 | # regex literals |
72 | ||
73 | print "not " unless "\xDF" =~ /\x{3AF}/; | |
74 | print "ok 16\n"; | |
75 | ||
76 | print "not " unless "\x{3AF}" =~ /\xDF/; | |
77 | print "ok 17\n"; | |
78 | ||
79 | print "not " unless "\xDF" =~ /\xDF/; | |
80 | print "ok 18\n"; | |
81 | ||
82 | print "not " unless "\x{3AF}" =~ /\x{3AF}/; | |
83 | print "ok 19\n"; | |
84 |