From: Adrian M. Enache <enache@rdslink.ro>
Date: Thu, 21 Aug 2003 21:17:26 +0000 (+0300)
Subject: utf8 variable names scrambled in error messages
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=608b3986f5e84a9d4745493bf572b18115a97390;p=p5sagit%2Fp5-mst-13.2.git

utf8 variable names scrambled in error messages
Message-ID: <20030821181726.GA1241@ratsnest.hole>

p4raw-id: //depot/perl@20805
---

diff --git a/gv.c b/gv.c
index 8a9b803..2fe604b 100644
--- a/gv.c
+++ b/gv.c
@@ -761,12 +761,15 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type)
 
     if (!stash) {
 	if (add) {
-	    qerror(Perl_mess(aTHX_
+	    register SV *err = Perl_mess(aTHX_
 		 "Global symbol \"%s%s\" requires explicit package name",
 		 (sv_type == SVt_PV ? "$"
 		  : sv_type == SVt_PVAV ? "@"
 		  : sv_type == SVt_PVHV ? "%"
-		  : ""), name));
+		  : ""), name);
+	    if (USE_UTF8_IN_NAMES)
+		SvUTF8_on(err);
+	    qerror(err);
 	    stash = GvHV(gv_fetchpv("<none>::", GV_ADDMULTI, SVt_PVHV));
 	}
 	else
diff --git a/t/op/die.t b/t/op/die.t
index e9387a2..6f62afb 100755
--- a/t/op/die.t
+++ b/t/op/die.t
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..13\n";
+print "1..14\n";
 
 $SIG{__DIE__} = sub { print ref($_[0]) ? ("ok ",$_[0]->[0]++,"\n") : @_ } ;
 
@@ -57,4 +57,7 @@ print "ok 10\n";
     print "ok 12\n";
     eval { warn $msg }; print "not " unless $err eq $msg;
     print "ok 13\n";
+    eval qq/ use strict; \$\x{3b1} /;
+    print "not " unless $@ =~ /Global symbol "\$\x{3b1}"/;
+    print "ok 14\n";
 }