perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Wichitill <>
Subject Re: [mp2] "Unrecognized character" error when running scripts in utf-8
Date Sun, 07 Nov 2004 19:26:39 GMT
Stas Bekman wrote:
>> 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/, and suggest a fix.

The reason for the failure is pretty clear, the BOM ends up somewhere in the 
middle of the string that is eval'ed to generate the package. On Linux, I 
was able to fix that by removing the BOM in RegistryCooker::read_script():

     # remove BOM
     ${$self->{CODE}} =~ s/^(?:
         \xef\xbb\xbf     |
         \xfe\xff         |
         \xff\xfe         |
         \x00\x00\xfe\xff |

For some reason that I haven't figured out yet, this doesn't work on 
Windows. With the ^ anchor in place, the BOM isn't getting removed, with the 
  ^ anchor gone, the script doesn't seem to receive its request object in @_.

Report problems:
Mail list info:
List etiquette:

View raw message