From eff7e11288b8365a3f03c78af19470ed4032ec9d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 26 Jun 2008 09:53:20 +0000 Subject: [PATCH] =?utf8?q?HTML-Templates=20vor=20und=20nicht=20nach=20der?= =?utf8?q?=20Verarbeitung=20durch=20die=20Template-Klasse=20mit=20iconv=20?= =?utf8?q?in=20das=20$db=5Fcharset=20konvertieren.=20Andernfalls=20w=C3=BC?= =?utf8?q?rden=20Daten,=20die=20bereits=20im=20$db=5Fcharset=20vorliegen,?= =?utf8?q?=20erneut=20konvertiert=20und=20damit=20falsch=20codiert=20sein.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index d8077528f..0aa7fb69c 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -41,6 +41,7 @@ use Data::Dumper; use CGI; use CGI::Ajax; use Cwd; +use IO::File; use SL::Auth; use SL::Auth::DB; use SL::Auth::LDAP; @@ -729,13 +730,26 @@ sub parse_html_template { map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self }; + my $in = IO::File->new($file, 'r'); + + if (!$in) { + print STDERR "Error opening template file: $!"; + $main::lxdebug->leave_sub(); + return ''; + } + + my $input = join('', <$in>); + $in->close(); + + if ($main::locale) { + $input = $main::locale->{iconv}->convert($input); + } + my $output; - if (!$template->process($file, $additional_params, \$output)) { + if (!$template->process(\$input, $additional_params, \$output)) { print STDERR $template->error(); } - $output = $main::locale->{iconv}->convert($output) if ($main::locale); - $main::lxdebug->leave_sub(); return $output; -- 2.20.1