This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
I'll finally get it right. (thanks to Sadahiro Tomoyuki)
[perl5.git] / doio.c
diff --git a/doio.c b/doio.c
index e0a1fc5..88afb1d 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -1225,9 +1225,14 @@ Perl_do_print(pTHX_ register SV *sv, PerlIO *fp)
        tmps = SvPV_const(sv, len);
        if (PerlIO_isutf8(fp)) {
            if (!SvUTF8(sv)) {
+               const STRLEN origlen = len;
                /* We don't modify the original scalar.  */
                tmpbuf = bytes_to_utf8((const U8*) tmps, &len);
                tmps = (char *) tmpbuf;
+               if (ckWARN(WARN_UTF8) && len != origlen) {
+                   Perl_warner(aTHX_ packWARN(WARN_UTF8),
+                               "Variable length character upgraded in print");
+               }
            }
        }
        else if (DO_UTF8(sv)) {