Export to GitHub

perl-compiler - issue #200

unicode hash keys not working?


Posted on Nov 12, 2013 by Massive Lion

Want: $>perl -e '%u = ("\x{123}", "fo"); ($u{"\x{123}"} eq "fo") ? print "There\n" : print "Not there\n";' There

Got: $>perlcc -r -e '%u = ("\x{123}", "fo"); ($u{"\x{123}"} eq "fo") ? print "There\n" : print "Not there\n";' Not there

Perl 5.14 running on C6

Comment #1

Posted on Nov 12, 2013 by Massive Bear

duplicate of issue 166

Comment #2

Posted on Nov 12, 2013 by Massive Lion

Can't be a duplicate given issue 166 is closed...

Comment #3

Posted on Nov 12, 2013 by Grumpy Rhino

Incorrect HEK LEN. Need to workaround B limitationsa, as B does not return HEK lengths

Comment #4

Posted on Nov 12, 2013 by Massive Elephant

most likely would fix op/utfhash.t

seems to also be the underlying issue for op/utftaint.t (some action ata distance is making a small test tricky)

Comment #5

Posted on Nov 12, 2013 by Grumpy Rhino

(No comment was entered for this change.)

Comment #6

Posted on Nov 12, 2013 by Grumpy Rhino

Two cases: compile-time storage of heks and run-time creation

tests[200]='%u=("\x{123}"=>"fo"); print "ok" if $u{"\x{123}"} eq "fo"' result[200]='ok' tests[2001]='BEGIN{%u=("\x{123}"=>"fo");} print "ok" if $u{"\x{123}"} eq "fo";' result[2001]='ok'

Comment #7

Posted on Nov 12, 2013 by Grumpy Rhino

Partially fixed with commit e1b7f863a240ab9f349f5e5d092ded24bc468459 Author: Reini Urban Date: Tue Nov 12 14:28:42 2013 -0600

C: support utf8 HEKs (hashkeys)

but not fully yet. fixes testc.sh 200 but not 2001 yet.
if a hv->ARRAY[0] key is UTF8 it is not yet detected and stored as ASCII

Comment #8

Posted on Nov 12, 2013 by Grumpy Rhino

(No comment was entered for this change.)

Comment #9

Posted on Nov 13, 2013 by Grumpy Rhino

Fully fixed now with commit 53fc84e28c9d04d14fb5b76664dad3fbbfff4706 Author: Reini Urban Date: Wed Nov 13 14:31:16 2013 -0600

C.xs 1.42_54: support utf8 hash keys by adding B::HV::HvARRAY_utf8

See RT #120535 for the core perl fix
This fixes also the 2nd compile-time case of #200.

Status: Fixed

Labels:
Type-Defect Priority-Medium