TWiki.pm calls CGI::charset during BEGIN{} if {Site}{CharSet} is set. Unfortunately under mod_perl, a directive like
PerlModule "TWiki.pm" fails because CGI needs to instantiate itself to set charset (charset is an instance variable) and instantiating itself under mod_perl requires the global $r Apache::RequestRec to exist, which it won't yet during perl startup. The solution should be to move the CGI::charset call outside of the BEGIN{} block.
--
TWiki:Main/JoshuaCharlesCampbell - 26 May 2008
CGI 3.15
perl 5.8.8 (.10.el5_0.2)
Centos 5.1
--
TWiki:Main.JoshuaCharlesCampbell - 26 May 2008
Patch vs 4.2.0:
--- lib/TWiki.pm.old 2008-05-26 22:16:34.000000000 -0600
+++ lib/TWiki.pm 2008-05-26 22:17:36.000000000 -0600
@@ -330,12 +330,6 @@
$functionTags{SHORTLANG} = sub { $TWiki::cfg{Site}{Lang} || '' };
$functionTags{LANG} = sub { $TWiki::cfg{Site}{FullLang} || '' };
- # Tell CGI.pm which charset we are using if not default
- if( defined $TWiki::cfg{Site}{CharSet} &&
- $TWiki::cfg{Site}{CharSet} !~ /^iso-?8859-?1$/io ) {
- CGI::charset( $TWiki::cfg{Site}{CharSet} );
- }
-
# Set up pre-compiled regexes for use in rendering. All regexes with
# unchanging variables in match should use the '/o' option.
# In the regex hash, all precompiled REs have "Regex" at the
@@ -1265,6 +1259,12 @@
$query ||= new CGI( {} );
my $this = bless( {}, $class );
+ # Tell CGI.pm which charset we are using if not default
+ if( defined $TWiki::cfg{Site}{CharSet} &&
+ $TWiki::cfg{Site}{CharSet} !~ /^iso-?8859-?1$/io ) {
+ $query->charset( $TWiki::cfg{Site}{CharSet} );
+ }
+
$this->{_HTMLHEADERS} = {};
$this->{context} = $initialContext;
--
TWiki:Main.JoshuaCharlesCampbell - 27 May 2008
Good catch, Joshua. There is no point in setting the charset until CGI is up and running.
Confirmed, and reprioritised to Urgent. Someone needs to apply the patch (I've checked it, it's good)
--
CrawfordCurrie - 27 May 2008
patch monkey do
--
SvenDowideit - 27 May 2008