From 372816e8ef5cc940caaab1d57d63ac0416e644c6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Mar 2014 17:22:27 +0100 Subject: [PATCH] Bug 11944: Remove obsolete encoding routines We don't need to decode manually which provide nice performance boost. Signed-off-by: Paola Rossi Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Dobrica Pavlinusic Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- C4/Templates.pm | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/C4/Templates.pm b/C4/Templates.pm index 836d4e8e50..23f8bce273 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -112,19 +112,10 @@ sub output { C4::Context->preference('opaclayoutstylesheet'); # add variables set via param to $vars for processing - # and clean any utf8 mess for my $k ( keys %{ $self->{VARS} } ) { $vars->{$k} = $self->{VARS}->{$k}; - if (ref($vars->{$k}) eq 'ARRAY'){ - utf8_arrayref($vars->{$k}); - } - elsif (ref($vars->{$k}) eq 'HASH'){ - utf8_hashref($vars->{$k}); - } - else { - utf8::encode($vars->{$k}) if utf8::is_utf8($vars->{$k}); - } } + my $data; binmode( STDOUT, ":utf8" ); $template->process( $self->filename, $vars, \$data ) @@ -132,36 +123,6 @@ sub output { return $data; } -sub utf8_arrayref { - my $arrayref = shift; - foreach my $element (@$arrayref){ - if (ref($element) eq 'ARRAY'){ - utf8_arrayref($element); - next; - } - if (ref($element) eq 'HASH'){ - utf8_hashref($element); - next; - } - utf8::encode($element) if utf8::is_utf8($element); - } -} - -sub utf8_hashref { - my $hashref = shift; - for my $key (keys %{$hashref}){ - if (ref($hashref->{$key}) eq 'ARRAY'){ - utf8_arrayref($hashref->{$key}); - next; - } - if (ref($hashref->{$key}) eq 'HASH'){ - utf8_hashref($hashref->{$key}); - next; - } - utf8::encode($hashref->{$key}) if utf8::is_utf8($hashref->{$key}); - } -} - # wrapper method to allow easier transition from HTML template pro to Template Toolkit sub param { my $self = shift; -- 2.39.5