summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-09-10 06:57:16 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-09-10 06:57:16 +0000
commitd3b4e16f4348ab55ddb8e9e8a4e27b46567d2855 (patch)
tree3a9d2dc19b5101a9ef5b5fa5ed2972ba62d9f83e /pp_hot.c
parent81cd54e3d8dc0f62b7c4bf5206036c9493ef5300 (diff)
downloadperl-d3b4e16f4348ab55ddb8e9e8a4e27b46567d2855.tar.gz
[perl #23770] Reading a latin1 file with open(... "<:utf8") will freeze
is no more valid, the script doesn't freeze, but I noticed that neither does the <FILE> complain about bad UTF-8 as it should and as it does with :encoding(utf8). p4raw-id: //depot/perl@21153
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 0851ab8d1e..1de483c3fa 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1569,6 +1569,16 @@ Perl_do_readline(pTHX)
MAYBE_TAINT_LINE(io, sv);
RETURN;
}
+ if (SvUTF8(sv)) {
+ U8 *f;
+
+ if (ckWARN(WARN_UTF8) &&
+ !Perl_is_utf8_string_loc(aTHX_ (U8*)SvPVX(sv), SvCUR(sv), &f))
+ /* Emulate :encoding(utf8) warning in the same case. */
+ Perl_warner(aTHX_ packWARN(WARN_UTF8),
+ "utf8 \"\\x%02X\" does not map to Unicode",
+ f < (U8*)SvEND(sv) ? *f : 0);
+ }
MAYBE_TAINT_LINE(io, sv);
IoLINES(io)++;
IoFLAGS(io) |= IOf_NOLINE;