From 422653b9d46cdba4248f81ba2c3c65c5804e830f 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 --- C4/Templates.pm | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/C4/Templates.pm b/C4/Templates.pm index cf18140..7b9fd41 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -115,19 +115,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 ) @@ -135,37 +126,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}); - } -} - - # FIXME - this is a horrible hack to cache # the current known-good language, temporarily # put in place to resolve bug 4403. It is -- 1.7.10.4