From c7a40c1c6b08744cc95ea90a65b64ac150437a8a 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 --- C4/Templates.pm | 41 +---------------------------------------- 1 files changed, 1 insertions(+), 40 deletions(-) diff --git a/C4/Templates.pm b/C4/Templates.pm index 4e082cc..b2c7dcb 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -114,19 +114,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 ) @@ -134,36 +125,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; -- 1.7.2.5