Skip to content

Commit

Permalink
Item9418: Uploading files causes fatal error
Browse files Browse the repository at this point in the history
CGI::Charset must be called after the CGI object has been created
Otherwise we loose things like the tmp file during uploads
Thanks to Crawford for helping where to move the call.
That was a looong night to find the root cause of this one ;-)


git-svn-id: http://svn.foswiki.org/trunk@8388 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
KennethLavrsen authored and KennethLavrsen committed Aug 1, 2010
1 parent 373b2d8 commit 1edfa25
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/lib/Foswiki.pm
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,6 @@ BEGIN {
setlocale( &LC_COLLATE, $Foswiki::cfg{Site}{Locale} );
}

if ( defined $Foswiki::cfg{Site}{CharSet} ) {

# Ensure the auto-encoding in CGI uses the correct character set.
# CGI defaults to iso-8859-1, and has a special exception for
# iso-8859-1 and windows1252 in CGI::escapeHTML which breaks
# UTF-8 content. See Item758. Get this wrong, and CGI will
# fail to encode certain UTF-8 characters correctly.
CGI::charset( $Foswiki::cfg{Site}{CharSet} );
}

$macros{CHARSET} = sub {
$Foswiki::cfg{Site}{CharSet} || CGI::charset();
};
Expand Down Expand Up @@ -1623,6 +1613,16 @@ sub new {

$query ||= new Foswiki::Request();
my $this = bless( { sandbox => 'Foswiki::Sandbox' }, $class );

if ( defined $Foswiki::cfg{Site}{CharSet} ) {

# Ensure the auto-encoding in CGI uses the correct character set.
# CGI defaults to iso-8859-1, and has a special exception for
# iso-8859-1 and windows1252 in CGI::escapeHTML which breaks
# UTF-8 content. See Item758. Get this wrong, and CGI will
# fail to encode certain UTF-8 characters correctly.
CGI::charset( $Foswiki::cfg{Site}{CharSet} );
}

$this->{request} = $query;
$this->{cgiQuery} = $query; # for backwards compatibility in contribs
Expand Down

0 comments on commit 1edfa25

Please sign in to comment.