In this particular case, the name of the current package in UTF-8 (it
cannot be expressed in Latin-1) is the same byte sequence as the name
of the package being assigned to in Latin-1.
Some of the logic in stashpv_hvname_match was faulty. It worked for
a Latin-1 current package assigning to a glob in a UTF-8 package, but
not the other way around.
use strict;
eval 'package foo; @bar = 1' or die;
EXPECT
+########
+# UTF8 and Latin1 package names equivalent at the byte level
+use utf8;
+# ĵ in UTF-8 is the same as ĵ in Latin-1
+package ĵ;
+*ĵ::bar = [];
+use strict;
+eval 'package ĵ; @bar = 1' or die;
+EXPECT
if (!stashpv || !name)
return stashpv == name;
- if ( HvNAMEUTF8(hv) && !utf8 ) {
+ if ( !HvNAMEUTF8(hv) != !utf8 ) {
if (utf8) {
return (bytes_cmp_utf8(
(const U8*)stashpv, len,