This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
open.pm minor cleanup
[perl5.git] / t / lib / warnings / utf8
CommitLineData
f0df466a
JH
1
2 utf8.c AOK
3
4 [utf8_to_uv]
5 Malformed UTF-8 character
6 my $a = ord "\x80" ;
7
8 Malformed UTF-8 character
9 my $a = ord "\xf080" ;
10 <<<<<< this warning can't be easily triggered from perl anymore
11
12 [utf16_to_utf8]
13 Malformed UTF-16 surrogate
14 <<<<<< Add a test when somethig actually calls utf16_to_utf8
15
16__END__
17# utf8.c [utf8_to_uv] -W
18BEGIN {
19 if (ord('A') == 193) {
20 print "SKIPPED\n# ebcdic platforms do not generate Malformed UTF-8 warnings.";
21 exit 0;
22 }
23}
24use utf8 ;
25my $a = "snøstorm" ;
26{
27 no warnings 'utf8' ;
28 my $a = "snøstorm";
29 use warnings 'utf8' ;
30 my $a = "snøstorm";
31}
32EXPECT
41432148
JH
33Malformed UTF-8 character (unexpected non-continuation byte 0x73, immediately after start byte 0xf8) at - line 9.
34Malformed UTF-8 character (unexpected non-continuation byte 0x73, immediately after start byte 0xf8) at - line 14.
f0df466a 35########
507b9800
JH
36use warnings 'utf8';
37my $surr = chr(0xD800);
38my $fff3 = chr(0xFFFE);
39my $ffff = chr(0xFFFF);
40no warnings 'utf8';
41$surr = chr(0xD800);
42$fffe = chr(0xFFFE);
43$ffff = chr(0xFFFF);
44EXPECT
45UTF-16 surrogate 0xd800 at - line 2.
46Unicode character 0xfffe is illegal at - line 3.
47Unicode character 0xffff is illegal at - line 4.
48########