maard has asked for the wisdom of the Perl Monks concerning the following question:
My script works well under perl interpreter, but dies when compiled with perl2exe (from Indigo Star). The message is: "Can't locate utf8.pm in @INC ...".
The error appears in HTML::Template module at the point where regular expression is applied to template string.
The template string, passed to the module is decoded into perl's internal form with either of commands:
open(my $fh, "<:encoding($enc)", $filename);
or:
decode($content, $enc, 1);
and then the filehandle/scalarref is passed to HTML::Template->new.
When I don't decode (or when I use 2-argument open) there's no error, but output from template is displayed in wrong encoding. Input template can be in one of several encodings, so I want user to decide which encoding to use, rather then force them to use single encoding. That's why I need 3-argument open (or manual decoding).
I know that "use utf8" can't help, but I tried to include it in script and recompile the binary... It didn't help.
The only info I found about utf8 and regexps was in perlunicode: regexp engine creates 2 versions of compiled regexp - for byte and character strings.
It seems to me that perl for some reason tries to convert regexp into internal form (why it needs utf8 module then?), but fails to find it.
What's the solution? What module shuold I explicitly "use" in my script for this error to disappear? Or maybe there's deeper explanation & solution?
perl: 5.8.4
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: re + utf8 problem
by tachyon (Chancellor) on Sep 27, 2004 at 09:59 UTC | |
by maard (Pilgrim) on Sep 27, 2004 at 10:59 UTC | |
by maard (Pilgrim) on Sep 27, 2004 at 10:20 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |