A user-supplied charnames translator for \N{} processing doesn't have to
return in UTF-8. Prior to this patch, the code in toke.c assumed it
did.
}
undef $w;
+ my $Cedilla_Latin1 = "GAR"
+ . latin1_to_native("\xC7")
+ . "ON";
+ my $Cedilla_utf8 = $Cedilla_Latin1;
+ utf8::upgrade($Cedilla_utf8);
+ eval qq[is("\\N{$Cedilla_Latin1}", "$Cedilla_Latin1", "A cedilla in character name works")];
+ undef $w;
+ {
+ use feature 'unicode_eval';
+ eval qq[use utf8; is("\\N{$Cedilla_utf8}", "$Cedilla_utf8", "... same under 'use utf8': they work")];
+ }
+
+ undef $w;
{
BEGIN { no strict; *CnameTest:: = *{"_charnames\0A::" } }
package CnameTest { sub translator { pop } }
const STRLEN off = d - SvPVX_const(sv);
d = off + SvGROW(sv, off + len + (STRLEN)(send - s) + 1);
}
+ if (! SvUTF8(res)) { /* Make sure is \N{} return is UTF-8 */
+ sv_utf8_upgrade(res);
+ str = SvPV_const(res, len);
+ }
Copy(str, d, len, char);
d += len;
}