In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/1097da16b21fe0a2257dba9937e55c0cca18f7e1?hp=99b847695211f825df6299aa9da91f9494f741e2>
- Log ----------------------------------------------------------------- commit 1097da16b21fe0a2257dba9937e55c0cca18f7e1 Author: Tony Cook <[email protected]> Date: Wed Jun 7 15:00:26 2017 +1000 [perl #131263] clear the UTF8 flag on a glob if it isn't UTF8 Previously sv_2pv_flags() would set the UTF8 flag on a glob if it had a UTF8 name, but wouldn't clear tha flag if it didn't. This meant a name change, eg. if assigned another glob, from a UTF8 name to a non-UTF8 name would leave the flag set. ----------------------------------------------------------------------- Summary of changes: sv.c | 2 ++ t/op/gv.t | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sv.c b/sv.c index 07d372cb07..4c3936b8c5 100644 --- a/sv.c +++ b/sv.c @@ -3185,6 +3185,8 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags) assert(SvPOK(buffer)); if (SvUTF8(buffer)) SvUTF8_on(sv); + else + SvUTF8_off(sv); if (lp) *lp = SvCUR(buffer); return SvPVX(buffer); diff --git a/t/op/gv.t b/t/op/gv.t index 713872523a..79519ca969 100644 --- a/t/op/gv.t +++ b/t/op/gv.t @@ -12,7 +12,7 @@ BEGIN { use warnings; -plan(tests => 282); +plan(tests => 284); # type coercion on assignment $foo = 'foo'; @@ -1170,6 +1170,14 @@ SKIP: { is ($? & 127, 0,"[perl #128597] No crash when gp_free calls ckWARN_d"); } +{ + # [perl #131263] + *sym = "\N{U+0080}"; + ok(*sym eq "*main::\N{U+0080}", "utf8 flag properly set"); + *sym = "\xC3\x80"; + ok(*sym eq "*main::\xC3\x80", "utf8 flag properly cleared"); +} + # test gv_try_downgrade() # If a GV can be stored in a stash in a compact, non-GV form, then # whenever ops are freed which reference the GV, an attempt is made to -- Perl5 Master Repository
