Re: [mp2] "Unrecognized character" error when running scripts in utf-8

[prev] [thread] [next] [Date index for 2004/11/07]

From: Stas Bekman
Subject: Re: [mp2] "Unrecognized character" error when running scripts in utf-8
Date: 16:12 on 07 Nov 2004
Игорь Кудашев wrote:
> Hi everybody. I ran into a problem with Perl scripts stored in utf-8
> and I couldn't find the answer to it on the Internet or mailing lists.
> Please tell me what I'm missing.
> 
> SYSTEM: Windows XP SP2, Active Perl 5.8.4.810, Apache 2.048, mod_perl
> 1.9912.
> 
> I need to run scripts stored in utf-8. Here is the code of a test
> SCRIPT:
> 
> use utf8; 
 > binmode(STDOUT, ":raw:utf8");
> print "Content-Type: text/html\n\n";
 > print "hello";

[...]

> I use the Windows' Notepad and save the file as utf-8. Everything works
> fine while I run the script from the command line or through CGI
> without mod_perl. PROBLEM: When I try to run the script using mod_perl,
> I get the following ERROR:
> 
> [error] 3320: ModPerl::PerlRun: Unrecognized character \xEF at
> .../CGI-FOO/TEST.PL line 1.
[...]
> It seems as if mod_perl doesn't recognize the format of the script file
> correctly. Any tips why this may occur? Thanks a bundle in advance!

Wow! That's interesting.

Please take a look at the code in function 
convert_script_to_compiled_handler at 
ModPerl-Registry/lib/ModPerl/RegistryCooker.pm, and suggest a fix. You 
probably want to add:

use Carp;
$SIG{__DIE__} = \&Carp::confess;

somewhere at the startup to see where exactly it fails.

Also I'd appreciate if you could send this script with BOM as an 
attachment so that we can test it. Not sure if it'll be reproducable on linux.


        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

(message missing)

[mp2] =?koi8-r?Q?=22?=Unrecognized character=?koi8-r?Q?=22=20?=error when running scripts in utf-8
=?koi8-r?Q?=E9=C7=CF=D2=D8=20=EB=D5=C4=C1=DB=C5=D7=20?= 13:23 on 07 Nov 2004

Re[2]: [mp2] =?koi8-r?Q?=22?=Unrecognized character=?koi8-r?Q?=22=20?=error when running scripts inutf-8
=?koi8-r?Q?=E9=C7=CF=D2=D8=20=EB=D5=C4=C1=DB=C5=D7=20?= 12:09 on 08 Nov 2004

Re: [mp2] "Unrecognized character" error when running scripts in utf-8
Stas Bekman 16:12 on 07 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52