Make write() (i.e. formats) utf8-aware by calling do_print() rather
Nick Ing-Simmons [Sat, 9 Dec 2000 20:11:48 +0000 (20:11 +0000)]
than raw PerlIO_write() - does not seem to break any tests.

p4raw-id: //depot/perlio@8055

pp_sys.c

index e4640be..4e89351 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1265,13 +1265,16 @@ PP(pp_leavewrite)
                s++;
            }
            if (s) {
-               PerlIO_write(ofp, SvPVX(PL_formtarget), s - SvPVX(PL_formtarget));
+               STRLEN save = SvCUR(PL_formtarget);
+               SvCUR_set(PL_formtarget, s - SvPVX(PL_formtarget));
+               do_print(PL_formtarget, ofp);
+               SvCUR_set(PL_formtarget, save);
                sv_chop(PL_formtarget, s);
                FmLINES(PL_formtarget) -= IoLINES_LEFT(io);
            }
        }
        if (IoLINES_LEFT(io) >= 0 && IoPAGE(io) > 0)
-           PerlIO_write(ofp, SvPVX(PL_formfeed), SvCUR(PL_formfeed));
+           do_print(PL_formfeed, ofp);
        IoLINES_LEFT(io) = IoPAGE_LEN(io);
        IoPAGE(io)++;
        PL_formtarget = PL_toptarget;
@@ -1332,8 +1335,7 @@ PP(pp_leavewrite)
            if (ckWARN(WARN_IO))
                Perl_warner(aTHX_ WARN_IO, "page overflow");
        }
-       if (!PerlIO_write(ofp, SvPVX(PL_formtarget), SvCUR(PL_formtarget)) ||
-               PerlIO_error(fp))
+       if (!do_print(PL_formtarget, fp))
            PUSHs(&PL_sv_no);
        else {
            FmLINES(PL_formtarget) = 0;