in reply to Can't decode ill-formed UTF-8 octet sequence <FF> at /usr/share/perl5/CGI.pm line 1116.

I am unable to reproduce your findings. After removing the apparently unnecessary use utf8::all; the script runs fine to completion with no warnings or errors:

$ ./1178644.pl "$FOO" $ perl -v This is perl 5, version 20, subversion 3 (v5.20.3) built for x86_64-li +nux-thread-multi (with 16 registered patches, see perl -V for more detail) Copyright 1987-2015, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. $

with $FOO set to be "tekst=Οὐχὶ ταὐτὰ παρίσταταί". This is using version 4.21 of CGI. Which version are you using and what input are you supplying to produce the stated error message?

  • Comment on Re: Can't decode ill-formed UTF-8 octet sequence <FF> at /usr/share/perl5/CGI.pm line 1116.
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Can't decode ill-formed UTF-8 octet sequence <FF> at /usr/share/perl5/CGI.pm line 1116.
by nikolay (Beadle) on Dec 31, 2016 at 09:38 UTC

    When i remove utf8::all; , i get 500 - Internal Server Error message. And nothing in the server (lighttpd) log.

    When i tried to run the script from my command line, like

    1.pl tekst="&#1092;&#1099;&#1074;&#1072;&#1092;&#1099;&#1072;" i got no error message w/ turned off utf8::all; and
    Status: 500 Content-type: text/html <h1>Software error:</h1> <pre>Cannot decode string with wide characters at /usr/lib/i386-linux- +gnu/perl/5.24/Encode.pm line 202.</pre> <p>For help, please send mail to this site's webmaster, giving this er +ror message and the time and date of the error.</p> [Sat Dec 31 16:27:02 2016] 1.pl: Cannot decode string with wide charac +ters at /usr/lib/i386-linux-gnu/perl/5.24/Encode.pm line 202.

    w/ turned on -- that simply shows that the string is already in UTF-8.

    Mine versions of software are: perl 5.24.1, and CGI -- 4.35.

Re^2: Can't decode ill-formed UTF-8 octet sequence <FF> at /usr/share/perl5/CGI.pm line 1116.
by nikolay (Beadle) on Dec 31, 2016 at 10:17 UTC

    Thank you for your research and idea of removing the use utf8; ! -- I would never guess that!

    By the way, why do you suppose that it is useless here? -- As i understand, that directive tells PERL about script encoding, does it?

      Yes, it does that and some more (see the documentation). Since there are no utf8 characters in your script and since you are handling the CGI parameter decoding yourself explicity then there is no need to use this module. Without it everything seems to run smoothly for me and, according to your follow-up post above, also for you.