Perl-Critic / PPI

54 stars 44 forks source link

dies with unicode bare key name #258

Open plicease opened 3 years ago

plicease commented 3 years ago

First reported with to Perl::Critic, since I wasn't sure if the problem was there or here. However, it seems to be reproducible with ppidump (see https://github.com/Perl-Critic/Perl-Critic/issues/948#issuecomment-809680380 ), so I believe this is indeed a PPI issue.

code:

use utf8;
my %x = (Привет => 1);

my($key) = keys %x;
die unless $key eq 'Привет';

perlcritic:

% perlcritic .
Problem while critiquing "foo.pl": Can't parse code: Encountered unexpected character '208'

It does work when I change it to 'Привет' => 1)

I admit to not being 100% certain that you can use a bare unicode key name like this, but the code does seem to work as intended. If so a more useful diagnostic would indicate where the character is located, if that is possible.

oalders commented 2 years ago

Some notes on unicode support: https://metacpan.org/pod/PPI#Internationalisation