__END__
# utf8.c [utf8_to_uvchr_buf] -W
+# NAME Malformed under 'use utf8' in double-quoted string
BEGIN {
if (ord('A') == 193) {
print "SKIPPED\n# ebcdic platforms generates different Malformed UTF-8 warnings.";
}
}
use utf8 ;
+no warnings; # Malformed is a fatal error, so gets output anyway.
my $a = "snøstorm" ;
-{
- no warnings 'utf8' ;
- my $a = "snøstorm";
- use warnings 'utf8' ;
- my $a = "snøstorm";
+EXPECT
+Malformed UTF-8 character: \xf8\x73\x74\x6f\x72 (unexpected non-continuation byte 0x73, immediately after start byte 0xf8; need 5 bytes, got 1) at - line 10.
+Malformed UTF-8 character (fatal) at - line 10.
+########
+# NAME Malformed under 'use utf8' in single-quoted string
+BEGIN {
+ if (ord('A') == 193) {
+ print "SKIPPED\n# ebcdic platforms generates different Malformed UTF-8 warnings.";
+ exit 0;
+ }
}
+use utf8 ;
+no warnings; # Malformed is a fatal error, so gets output anyway.
+my $a = 'snøstorm' ;
EXPECT
Malformed UTF-8 character: \xf8\x73\x74\x6f\x72 (unexpected non-continuation byte 0x73, immediately after start byte 0xf8; need 5 bytes, got 1) at - line 9.
-Malformed UTF-8 character: \xf8\x73\x74\x6f\x72 (unexpected non-continuation byte 0x73, immediately after start byte 0xf8; need 5 bytes, got 1) at - line 14.
+Malformed UTF-8 character (fatal) at - line 9.
########
use warnings 'utf8';
my $d7ff = uc(chr(0xD7FF));
STRLEN linestart_pos, last_uni_pos, last_lop_pos;
bool got_some_for_debugger = 0;
bool got_some;
+ const U8* first_bad_char_loc;
+
if (flags & ~(LEX_KEEP_PREVIOUS|LEX_FAKE_EOF|LEX_NO_TERM))
Perl_croak(aTHX_ "Lexing code internal error (%s)", "lex_next_chunk");
if (!(flags & LEX_NO_TERM) && PL_lex_inwhat)
new_bufend_pos = SvCUR(linestr);
PL_parser->bufend = buf + new_bufend_pos;
PL_parser->bufptr = buf + bufptr_pos;
+
+ if (UTF && ! is_utf8_string_loc((U8 *) PL_parser->bufptr,
+ PL_parser->bufend - PL_parser->bufptr,
+ &first_bad_char_loc))
+ {
+
+ _force_out_malformed_utf8_message(first_bad_char_loc,
+ (U8 *) PL_parser->bufend,
+ 0,
+ 1 /* 1 means die */ );
+ NOT_REACHED; /* NOTREACHED */
+ }
+
PL_parser->oldbufptr = buf + oldbufptr_pos;
PL_parser->oldoldbufptr = buf + oldoldbufptr_pos;
PL_parser->linestart = buf + linestart_pos;