From: Rafael Garcia-Suarez Date: Tue, 29 Jul 2003 11:09:37 +0000 (+0200) Subject: [perl #22969] fix $hash{utf8bareword} X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5464dbd2048d8302bcdad7ae68f0e2c0042bc78f;p=p5sagit%2Fp5-mst-13.2.git [perl #22969] fix $hash{utf8bareword} Message-Id: <20030729110937.31c422d2.rgarcia@hexaflux.com> p4raw-id: //depot/perl@20288 --- diff --git a/t/op/utfhash.t b/t/op/utfhash.t index af7e6c1..9e0196b 100644 --- a/t/op/utfhash.t +++ b/t/op/utfhash.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; require './test.pl'; - plan(tests => 91); + plan(tests => 97); } use strict; @@ -170,3 +170,16 @@ foreach my $a ("\x7f","\xff") } } + +{ + # See if utf8 barewords work [perl #22969] + use utf8; + my %hash = (тест => 123); + is($hash{тест}, $hash{'тест'}); + is($hash{тест}, 123); + is($hash{'тест'}, 123); + %hash = (тест => 123); + is($hash{тест}, $hash{'тест'}); + is($hash{тест}, 123); + is($hash{'тест'}, 123); +} diff --git a/toke.c b/toke.c index 0274db2..9d1fed2 100644 --- a/toke.c +++ b/toke.c @@ -786,6 +786,8 @@ S_force_word(pTHX_ register char *start, int token, int check_keyword, int allow } PL_nextval[PL_nexttoke].opval = (OP*)newSVOP(OP_CONST,0, newSVpv(PL_tokenbuf,0)); PL_nextval[PL_nexttoke].opval->op_private |= OPpCONST_BARE; + if (UTF && !IN_BYTES && is_utf8_string((U8*)PL_tokenbuf, len)) + SvUTF8_on(((SVOP*)PL_nextval[PL_nexttoke].opval)->op_sv); force_next(token); } return s;