Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


perl5i + CGI::Simple makes warnings #163

tokuhirom opened this Issue · 7 comments

4 participants

  % perl5i -E 'use CGI::Simple; say CGI::Simple->VERSION'
  utf8 "\xF1" does not map to Unicode at /usr/local/app/perl-5.12.1/lib/site_perl/5.12.1/CGI/ line 474.

perl5i output warnings when require module contains non-utf8 chars.

more pointed code is following:

% perl -e 'print "package F;\n # \xF1\n;1;"' >
% perl5i -e 'require ""'
utf8 "\xF1" does not map to Unicode at line 1.

This code is not output warnings with plain perl5 interpreter.

% perl -e 'require ""'

There is a non-UTF8 character in there, but its in a comment way far away (España).

Anyhow, perl -wle 'use utf8; use warnings; use CGI::Simple doesn't provoke the warning. It shouldn't, utf8 should be lexical. Something perl5i is doing is letting it out of its box.

Valid bug.


And now it is utf8::all that's doing something wrong.

@doherty doherty referenced this issue from a commit in doherty/utf8-all
@doherty doherty Use :utf8 PerlIO layer instead of :encoding(UTF-8)
This is the non-strict version of the encoding, which silences
the warnings reported in evalEmpire/perl5i#163 and doherty/utfu-all#5

The bug is not in utf8::all but in perl itself. It seems require is affected by the open pragma, as can be seen in this example:

perl '-Mopen=:encoding(utf8)' -e 'require ""'

I'm not sure how to solve this (other than in perl 5.15.x)


This was discussed at some point on p5p. I meant to ask if there was a workaround older Perls could use, but I don't think I ever did. I should check who was talking about this and get in touch with them about it.

@doherty doherty referenced this issue in doherty/utf8-all

utf8::all is doing something un-lexical #5


Yes, using the :utf8 layer would work - however it's both the wrong way to solve the issue and also unsafe. I think the Perl bug was fixed, but I'm not sure if it was (or even can be) fixed in older Perls somehow. I'm open to advice on whether the hacky thing is the right way to do it.


The bug was fixed in core in 639dfab029, but that doesn't help users of perl < 5.15. You could do some trick with an OP check function, but I'm not sure that's worth it. Doing :utf8 is probably even be more undesirable though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.