xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/lib/warnings/utf8 (revision 0:68f95e015346)
1*0Sstevel@tonic-gate
2*0Sstevel@tonic-gate  utf8.c AOK
3*0Sstevel@tonic-gate
4*0Sstevel@tonic-gate     [utf8_to_uv]
5*0Sstevel@tonic-gate     Malformed UTF-8 character
6*0Sstevel@tonic-gate	my $a = ord "\x80" ;
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gate     Malformed UTF-8 character
9*0Sstevel@tonic-gate	my $a = ord "\xf080" ;
10*0Sstevel@tonic-gate     <<<<<< this warning can't be easily triggered from perl anymore
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gate     [utf16_to_utf8]
13*0Sstevel@tonic-gate     Malformed UTF-16 surrogate
14*0Sstevel@tonic-gate     <<<<<< Add a test when somethig actually calls utf16_to_utf8
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gate__END__
17*0Sstevel@tonic-gate# utf8.c [utf8_to_uv] -W
18*0Sstevel@tonic-gateBEGIN {
19*0Sstevel@tonic-gate    if (ord('A') == 193) {
20*0Sstevel@tonic-gate        print "SKIPPED\n# ebcdic platforms do not generate Malformed UTF-8 warnings.";
21*0Sstevel@tonic-gate        exit 0;
22*0Sstevel@tonic-gate    }
23*0Sstevel@tonic-gate}
24*0Sstevel@tonic-gateuse utf8 ;
25*0Sstevel@tonic-gatemy $a = "sn�storm" ;
26*0Sstevel@tonic-gate{
27*0Sstevel@tonic-gate    no warnings 'utf8' ;
28*0Sstevel@tonic-gate    my $a = "sn�storm";
29*0Sstevel@tonic-gate    use warnings 'utf8' ;
30*0Sstevel@tonic-gate    my $a = "sn�storm";
31*0Sstevel@tonic-gate}
32*0Sstevel@tonic-gateEXPECT
33*0Sstevel@tonic-gateMalformed UTF-8 character (unexpected non-continuation byte 0x73, immediately after start byte 0xf8) at - line 9.
34*0Sstevel@tonic-gateMalformed UTF-8 character (unexpected non-continuation byte 0x73, immediately after start byte 0xf8) at - line 14.
35*0Sstevel@tonic-gate########
36*0Sstevel@tonic-gateuse warnings 'utf8';
37*0Sstevel@tonic-gatemy $d7ff  = chr(0xD7FF);
38*0Sstevel@tonic-gatemy $d800  = chr(0xD800);
39*0Sstevel@tonic-gatemy $dfff  = chr(0xDFFF);
40*0Sstevel@tonic-gatemy $e000  = chr(0xE000);
41*0Sstevel@tonic-gatemy $feff  = chr(0xFEFF);
42*0Sstevel@tonic-gatemy $fffd  = chr(0xFFFD);
43*0Sstevel@tonic-gatemy $fffe  = chr(0xFFFE);
44*0Sstevel@tonic-gatemy $ffff  = chr(0xFFFF);
45*0Sstevel@tonic-gatemy $hex4  = chr(0x10000);
46*0Sstevel@tonic-gatemy $hex5  = chr(0x100000);
47*0Sstevel@tonic-gatemy $maxm1 = chr(0x10FFFE);
48*0Sstevel@tonic-gatemy $max   = chr(0x10FFFF);
49*0Sstevel@tonic-gateno warnings 'utf8';
50*0Sstevel@tonic-gatemy $d7ff  = chr(0xD7FF);
51*0Sstevel@tonic-gatemy $d800  = chr(0xD800);
52*0Sstevel@tonic-gatemy $dfff  = chr(0xDFFF);
53*0Sstevel@tonic-gatemy $e000  = chr(0xE000);
54*0Sstevel@tonic-gatemy $feff  = chr(0xFEFF);
55*0Sstevel@tonic-gatemy $fffd  = chr(0xFFFD);
56*0Sstevel@tonic-gatemy $fffe  = chr(0xFFFE);
57*0Sstevel@tonic-gatemy $ffff  = chr(0xFFFF);
58*0Sstevel@tonic-gatemy $hex4  = chr(0x10000);
59*0Sstevel@tonic-gatemy $hex5  = chr(0x100000);
60*0Sstevel@tonic-gatemy $maxm1 = chr(0x10FFFE);
61*0Sstevel@tonic-gatemy $max   = chr(0x10FFFF);
62*0Sstevel@tonic-gateEXPECT
63*0Sstevel@tonic-gateUTF-16 surrogate 0xd800 at - line 3.
64*0Sstevel@tonic-gateUTF-16 surrogate 0xdfff at - line 4.
65*0Sstevel@tonic-gateUnicode character 0xfffe is illegal at - line 8.
66*0Sstevel@tonic-gateUnicode character 0xffff is illegal at - line 9.
67*0Sstevel@tonic-gateUnicode character 0x10fffe is illegal at - line 12.
68*0Sstevel@tonic-gateUnicode character 0x10ffff is illegal at - line 13.
69*0Sstevel@tonic-gate########
70*0Sstevel@tonic-gateuse warnings 'utf8';
71*0Sstevel@tonic-gatemy $d7ff  = pack("U", 0xD7FF);
72*0Sstevel@tonic-gatemy $d800  = pack("U", 0xD800);
73*0Sstevel@tonic-gatemy $dfff  = pack("U", 0xDFFF);
74*0Sstevel@tonic-gatemy $e000  = pack("U", 0xE000);
75*0Sstevel@tonic-gatemy $feff  = pack("U", 0xFEFF);
76*0Sstevel@tonic-gatemy $fffd  = pack("U", 0xFFFD);
77*0Sstevel@tonic-gatemy $fffe  = pack("U", 0xFFFE);
78*0Sstevel@tonic-gatemy $ffff  = pack("U", 0xFFFF);
79*0Sstevel@tonic-gatemy $hex4  = pack("U", 0x10000);
80*0Sstevel@tonic-gatemy $hex5  = pack("U", 0x100000);
81*0Sstevel@tonic-gatemy $maxm1 = pack("U", 0x10FFFE);
82*0Sstevel@tonic-gatemy $max   = pack("U", 0x10FFFF);
83*0Sstevel@tonic-gateno warnings 'utf8';
84*0Sstevel@tonic-gatemy $d7ff  = pack("U", 0xD7FF);
85*0Sstevel@tonic-gatemy $d800  = pack("U", 0xD800);
86*0Sstevel@tonic-gatemy $dfff  = pack("U", 0xDFFF);
87*0Sstevel@tonic-gatemy $e000  = pack("U", 0xE000);
88*0Sstevel@tonic-gatemy $feff  = pack("U", 0xFEFF);
89*0Sstevel@tonic-gatemy $fffd  = pack("U", 0xFFFD);
90*0Sstevel@tonic-gatemy $fffe  = pack("U", 0xFFFE);
91*0Sstevel@tonic-gatemy $ffff  = pack("U", 0xFFFF);
92*0Sstevel@tonic-gatemy $hex4  = pack("U", 0x10000);
93*0Sstevel@tonic-gatemy $hex5  = pack("U", 0x100000);
94*0Sstevel@tonic-gatemy $maxm1 = pack("U", 0x10FFFE);
95*0Sstevel@tonic-gatemy $max   = pack("U", 0x10FFFF);
96*0Sstevel@tonic-gateEXPECT
97*0Sstevel@tonic-gateUTF-16 surrogate 0xd800 at - line 3.
98*0Sstevel@tonic-gateUTF-16 surrogate 0xdfff at - line 4.
99*0Sstevel@tonic-gateUnicode character 0xfffe is illegal at - line 8.
100*0Sstevel@tonic-gateUnicode character 0xffff is illegal at - line 9.
101*0Sstevel@tonic-gateUnicode character 0x10fffe is illegal at - line 12.
102*0Sstevel@tonic-gateUnicode character 0x10ffff is illegal at - line 13.
103*0Sstevel@tonic-gate########
104*0Sstevel@tonic-gateuse warnings 'utf8';
105*0Sstevel@tonic-gatemy $d7ff  = "\x{D7FF}";
106*0Sstevel@tonic-gatemy $d800  = "\x{D800}";
107*0Sstevel@tonic-gatemy $dfff  = "\x{DFFF}";
108*0Sstevel@tonic-gatemy $e000  = "\x{E000}";
109*0Sstevel@tonic-gatemy $feff  = "\x{FEFF}";
110*0Sstevel@tonic-gatemy $fffd  = "\x{FFFD}";
111*0Sstevel@tonic-gatemy $fffe  = "\x{FFFE}";
112*0Sstevel@tonic-gatemy $ffff  = "\x{FFFF}";
113*0Sstevel@tonic-gatemy $hex4  = "\x{10000}";
114*0Sstevel@tonic-gatemy $hex5  = "\x{100000}";
115*0Sstevel@tonic-gatemy $maxm1 = "\x{10FFFE}";
116*0Sstevel@tonic-gatemy $max   = "\x{10FFFF}";
117*0Sstevel@tonic-gateno warnings 'utf8';
118*0Sstevel@tonic-gatemy $d7ff  = "\x{D7FF}";
119*0Sstevel@tonic-gatemy $d800  = "\x{D800}";
120*0Sstevel@tonic-gatemy $dfff  = "\x{DFFF}";
121*0Sstevel@tonic-gatemy $e000  = "\x{E000}";
122*0Sstevel@tonic-gatemy $feff  = "\x{FEFF}";
123*0Sstevel@tonic-gatemy $fffd  = "\x{FFFD}";
124*0Sstevel@tonic-gatemy $fffe  = "\x{FFFE}";
125*0Sstevel@tonic-gatemy $ffff  = "\x{FFFF}";
126*0Sstevel@tonic-gatemy $hex4  = "\x{10000}";
127*0Sstevel@tonic-gatemy $hex5  = "\x{100000}";
128*0Sstevel@tonic-gatemy $maxm1 = "\x{10FFFE}";
129*0Sstevel@tonic-gatemy $max   = "\x{10FFFF}";
130*0Sstevel@tonic-gateEXPECT
131*0Sstevel@tonic-gateUTF-16 surrogate 0xd800 at - line 3.
132*0Sstevel@tonic-gateUTF-16 surrogate 0xdfff at - line 4.
133*0Sstevel@tonic-gateUnicode character 0xfffe is illegal at - line 8.
134*0Sstevel@tonic-gateUnicode character 0xffff is illegal at - line 9.
135*0Sstevel@tonic-gateUnicode character 0x10fffe is illegal at - line 12.
136*0Sstevel@tonic-gateUnicode character 0x10ffff is illegal at - line 13.
137