develooper Front page | perl.perl5.porters | Postings from June 2008

Re: [perl #56336] Unexpected UTF-8 flag in ascii strings

Thread Previous
From:
Rafael Garcia-Suarez
Date:
June 25, 2008 23:50
Subject:
Re: [perl #56336] Unexpected UTF-8 flag in ascii strings
Message ID:
b77c1dce0806252350o32a327a3g2c04605702f800e7@mail.gmail.com
2008/6/25 via RT Alex Kapranoff <perlbug-followup@perl.org>:
> It looks like in presence of `use utf8' barewords get the utf8 flag.
> Quoted string literals get this flag only if they contain characters
> with high codes -- in full accordance with the docs.
>
> Example (by ikegami):
> use utf8;
> sub ff { print utf8::is_utf8($_[0]) ? 1 : 0, "\n"; }
>
> ff("asd");               # 0
> ff('asd');               # 0
> ff(qw(asd));             # 0
>
> ff(asd => 1);            # 1
> { no strict; ff(asd); }  # 1
> ff(-asd);                # 1
> ff(asd::);               # 1
>
> PerlMonks discussion:
> http://perlmonks.com/?node_id=668987
>
> Checked in bleadperl as of today -- still the same.
>
> The most serious result of the bug is that equal ascii strings with and
> without the flag are serialized differently. Also, utf8 flag should slow
> down hash access (barewords are frequently used as keys).

I wouldn't qualify this as a bug. It's merely an implementation detail
and a potential room for optimisation.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About