summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-01-09 12:37:03 -0700
committerKarl Williamson <public@khwilliamson.com>2011-01-09 19:29:02 -0700
commit0876b9a01ce95023535c197900c755d5c98d616f (patch)
tree7da60e7cc7ebd37721babdc7b4466a35a2f7e596 /doio.c
parentbcd05b946b5a96ca0b2734a1042bda6af592c97b (diff)
downloadperl-0876b9a01ce95023535c197900c755d5c98d616f.tar.gz
Add check_utf8_print()
This new function looks for problematic code points on output, and warns if any are found, returning FALSE as well. What it warns about may change, so is marked as experimental.
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/doio.c b/doio.c
index c23780cc12..cecc574ba6 100644
--- a/doio.c
+++ b/doio.c
@@ -1224,6 +1224,9 @@ Perl_do_print(pTHX_ register SV *sv, PerlIO *fp)
tmpbuf = bytes_to_utf8((const U8*) tmps, &len);
tmps = (char *) tmpbuf;
}
+ else if (ckWARN_d(WARN_UTF8)) {
+ (void) check_utf8_print((const U8*) tmps, len);
+ }
}
else if (DO_UTF8(sv)) {
STRLEN tmplen = len;
@@ -1240,6 +1243,9 @@ Perl_do_print(pTHX_ register SV *sv, PerlIO *fp)
"Wide character in %s",
PL_op ? OP_DESC(PL_op) : "print"
);
+ /* Could also check that isn't one of the things to avoid
+ * in utf8 by using check_utf8_print(), but not doing so,
+ * since the stream isn't a UTF8 stream */
}
}
/* To detect whether the process is about to overstep its