From: Gurusamy Sarathy Date: Mon, 20 Mar 2000 20:37:42 +0000 (+0000) Subject: change#5797 didn't do the right thing for "\xff\N{WHITE SMILING FACE}" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f08d6ad944c4ecbe4ec19c801b6b512b040abbf6;p=p5sagit%2Fp5-mst-13.2.git change#5797 didn't do the right thing for "\xff\N{WHITE SMILING FACE}" p4raw-link: @5797 on //depot/perl: e1992b6d91e50ab66a903c570e8d9c48f121f34b p4raw-id: //depot/perl@5837 --- diff --git a/t/lib/charnames.t b/t/lib/charnames.t index a6fe47f..7643390 100644 --- a/t/lib/charnames.t +++ b/t/lib/charnames.t @@ -8,7 +8,7 @@ BEGIN { } $| = 1; -print "1..10\n"; +print "1..12\n"; use charnames ':full'; @@ -67,4 +67,8 @@ $encoded_bet = "\327\221"; print "ok 9\n"; print "not " unless sprintf("%vx", "\N{WHITE SMILING FACE}") eq "263a"; print "ok 10\n"; + print "not " unless sprintf("%vx", "\xFF\N{WHITE SMILING FACE}") eq "ff.263a"; + print "ok 11\n"; + print "not " unless sprintf("%vx", "\x{ff}\N{WHITE SMILING FACE}") eq "ff.263a"; + print "ok 12\n"; } diff --git a/toke.c b/toke.c index cb6751a..375d917 100644 --- a/toke.c +++ b/toke.c @@ -1479,8 +1479,14 @@ S_scan_const(pTHX_ char *start) res = new_constant( Nullch, 0, "charnames", res, Nullsv, "\\N{...}" ); str = SvPV(res,len); - if (len > 1) + if (!has_utf && SvUTF8(res)) { + char *ostart = SvPVX(sv); + SvCUR_set(sv, d - ostart); + SvPOK_on(sv); + sv_utf8_upgrade(sv); + d = SvPVX(sv) + SvCUR(sv); has_utf = TRUE; + } if (len > e - s + 4) { char *odest = SvPVX(sv);