This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
SvUTF8() for globs.
authorBrian Fraser <fraserbn@gmail.com>
Mon, 18 Jul 2011 16:36:09 +0000 (17:36 +0100)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 6 Oct 2011 20:01:01 +0000 (13:01 -0700)
This turns on the GV's UTF8 flag in sv.c when the GV is stringified.
This works the same way overloading and references work, in that the
SvUTF8 flag is only valid immediately after SvPV.

For Nick's much more detailed explanation, see
http://www.nntp.perl.org/group/perl.perl5.porters/2011/07/msg174703.html

sv.c

diff --git a/sv.c b/sv.c
index 73291a9..2d09ade 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -2961,6 +2961,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *const sv, STRLEN *const lp, const I32 flags
                if (lp) {
                    *lp = SvCUR(buffer);
                }
+                if ( SvUTF8(buffer) ) SvUTF8_on(sv);
                return SvPVX(buffer);
            }
            else {