From d8c3b43a5e31f8032bee4d08fd9db79cea6ac4a7 Mon Sep 17 00:00:00 2001 From: Ketan Kulkarni Date: Tue, 24 Sep 2013 15:53:55 +0530 Subject: [PATCH 1/3] test commit --- members/member.pl | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/members/member.pl b/members/member.pl index 78b762f..c72368b 100755 --- a/members/member.pl +++ b/members/member.pl @@ -197,3 +197,4 @@ $template->param( ); output_html_with_http_headers $input, $cookie, $template->output; +print $member; -- 1.7.1 From f4dcddf3a2dd2e8bba3a0173531ae923103505d4 Mon Sep 17 00:00:00 2001 From: Ketan Kulkarni Date: Thu, 26 Sep 2013 14:35:54 +0530 Subject: [PATCH 2/3] double utf8 encoding fix .. second try --- C4/ItemType.pm | 4 ++-- C4/Search.pm | 1 + C4/Templates.pm | 16 +++++++++++++--- members/member.pl | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/C4/ItemType.pm b/C4/ItemType.pm index ad253a7..4aa23d4 100644 --- a/C4/ItemType.pm +++ b/C4/ItemType.pm @@ -81,7 +81,7 @@ sub all { for ( @{$dbh->selectall_arrayref( "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} ) { - utf8::encode($_->{description}); + utf8::upgrade($_->{description}); push @itypes, $class->new($_); } return @itypes; @@ -105,7 +105,7 @@ sub get { "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); if ( $data->{description} ) { - utf8::encode($data->{description}); + utf8::upgrade($data->{description}); } return $class->new($data); } diff --git a/C4/Search.pm b/C4/Search.pm index 0453b91..ba559e8 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -574,6 +574,7 @@ sub getRecords { { # Sanitize the link value : parenthesis, question and exclamation mark will cause errors with CCL + utf8::decode($one_facet); my $facet_link_value = $one_facet; $facet_link_value =~ s/[()!?¡¿؟]/ /g; diff --git a/C4/Templates.pm b/C4/Templates.pm index 21604fc..b25bf0f 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -124,7 +124,15 @@ sub output { utf8_hashref($vars->{$k}); } else { - utf8::encode($vars->{$k}) if utf8::is_utf8($vars->{$k}); + if(utf8::is_utf8($vars->{$k})){ + utf8::upgrade($vars->{$k}); + } + else{ + ## this should not be needed (ideally :-) + ## this is included because, somewhere the input + ## is not getting utf8-decoded + utf8::decode($vars->{$k}); + } } } my $data; @@ -145,7 +153,8 @@ sub utf8_arrayref { utf8_hashref($element); next; } - utf8::encode($element) if utf8::is_utf8($element); + + utf8::upgrade($element) if utf8::is_utf8($element); } } @@ -160,7 +169,8 @@ sub utf8_hashref { utf8_hashref($hashref->{$key}); next; } - utf8::encode($hashref->{$key}) if utf8::is_utf8($hashref->{$key}); + + utf8::upgrade($hashref->{$key}) if utf8::is_utf8($hashref->{$key}); } } diff --git a/members/member.pl b/members/member.pl index c72368b..3efe1c4 100755 --- a/members/member.pl +++ b/members/member.pl @@ -85,6 +85,7 @@ if ($AddPatronLists=~/code/){ } my $member=$input->param('member') || ''; + my $orderbyparams=$input->param('orderby') || ''; my @orderby; if ($orderbyparams){ @@ -197,4 +198,3 @@ $template->param( ); output_html_with_http_headers $input, $cookie, $template->output; -print $member; -- 1.7.1 From 3a3e5e8f4fcebcc2e8bdad6c8b409a7e1cc0173b Mon Sep 17 00:00:00 2001 From: Ketan Kulkarni Date: Thu, 26 Sep 2013 14:38:29 +0530 Subject: [PATCH 3/3] minor formatting updates --- C4/Templates.pm | 2 -- members/member.pl | 1 - 2 files changed, 0 insertions(+), 3 deletions(-) diff --git a/C4/Templates.pm b/C4/Templates.pm index b25bf0f..b4f68ca 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -153,7 +153,6 @@ sub utf8_arrayref { utf8_hashref($element); next; } - utf8::upgrade($element) if utf8::is_utf8($element); } } @@ -169,7 +168,6 @@ sub utf8_hashref { utf8_hashref($hashref->{$key}); next; } - utf8::upgrade($hashref->{$key}) if utf8::is_utf8($hashref->{$key}); } } diff --git a/members/member.pl b/members/member.pl index 3efe1c4..78b762f 100755 --- a/members/member.pl +++ b/members/member.pl @@ -85,7 +85,6 @@ if ($AddPatronLists=~/code/){ } my $member=$input->param('member') || ''; - my $orderbyparams=$input->param('orderby') || ''; my @orderby; if ($orderbyparams){ -- 1.7.1