Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode issue reporting #11

Open
szabgab opened this issue Sep 9, 2013 · 6 comments
Open

Unicode issue reporting #11

szabgab opened this issue Sep 9, 2013 · 6 comments
Labels

Comments

@szabgab
Copy link

szabgab commented Sep 9, 2013

my $rule = Path::Iterator::Rule->new;
$rule->contents_match(qr/Perl/);
my $it = $rule->iter( @argv );
while ( my $file = $it->() ) {
say $file;
}

and I get tons of errors like this:

utf8 "\xC6" does not map to Unicode at /home/gabor/perl-5.18.0-desktop/lib/site_perl/5.18.0/Path/Iterator/Rule.pm line 500.

It would be probably better to report the file name and line number in the data files that generate this. At least optionally.

Using v1.005 on perl 5.18.0 on Linux

@dagolden
Copy link
Collaborator

Are you objecting to the errors (from not seeing the right encoding) or are you objecting to the error message not including the file/line number or both?

More generally, what would you want to get if you check contents_match on a set of mixed encoding files?

@szabgab
Copy link
Author

szabgab commented Sep 10, 2013

"objecting" sounds too negative, I would like to know which of my text files generated this warning and in which line.

I don't have an answer to the more general question. I just saw those errors and did not know where did they come from and what can I do now.

@dagolden
Copy link
Collaborator

According to perldiag, that error you got should be fatal. How did you get "tons of errors"? (Error handler?)

@dagolden
Copy link
Collaborator

Note to self: we could trap the error with eval in contents_match and line_match and rethrow it with the offending filename (and line number for line_match)

@szabgab
Copy link
Author

szabgab commented Sep 10, 2013

no Error handler involved, just plain iteration

my $rule = Path::Iterator::Rule->new;
$rule->size("> 1000")
->perl_file
->contents_match(qr/package/);

my $it = $rule->iter( @argv );
while ( my $file = $it->() ) {
say $file;
}

@dagolden
Copy link
Collaborator

Lovely. So perldiag is wrong for some reason or another.

Still, I could trap that with a warning handler. Ugh. Or maybe just 'no warnings 'utf8'' and let Perl do the best it can quietly

@xdg xdg added the bug label Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants