Bugzilla – Attachment 21488 Details for
Bug 6554
Resolve encoding problems with corrected UTF8 handling in templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
utf8 double encoding problem enhancement
enhancement1-utf8-double-encoding.patch (text/plain), 7.46 KB, created by
Ketan Kulkarni
on 2013-09-26 14:50:22 UTC
(
hide
)
Description:
utf8 double encoding problem enhancement
Filename:
MIME Type:
Creator:
Ketan Kulkarni
Created:
2013-09-26 14:50:22 UTC
Size:
7.46 KB
patch
obsolete
>From d8c3b43a5e31f8032bee4d08fd9db79cea6ac4a7 Mon Sep 17 00:00:00 2001 >From: Ketan Kulkarni <ketan@carvingit.com> >Date: Tue, 24 Sep 2013 15:53:55 +0530 >Subject: [PATCH 1/4] 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 <ketan@carvingit.com> >Date: Thu, 26 Sep 2013 14:35:54 +0530 >Subject: [PATCH 2/4] 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 <ketan@carvingit.com> >Date: Thu, 26 Sep 2013 14:38:29 +0530 >Subject: [PATCH 3/4] 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 > > >From f5455927bea40ed52411c4233cceb8d9f2547e21 Mon Sep 17 00:00:00 2001 >From: Ketan Kulkarni <ketan@carvingit.com> >Date: Thu, 26 Sep 2013 16:35:38 +0530 >Subject: [PATCH 4/4] enhancement to the previous patch related to utf8 double encoding > >--- > C4/Members.pm | 1 - > C4/Search.pm | 3 +-- > C4/Templates.pm | 10 +--------- > members/member.pl | 3 +++ > 4 files changed, 5 insertions(+), 12 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 7ac69df..d1c42a8 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -282,7 +282,6 @@ sub Search { > $searchtype = "exact"; > } > $searchtype ||= "start_with"; >- > return SearchInTable( "borrowers", $filter, $orderby, $limit, $columns_out, $search_on_fields, $searchtype ); > } > >diff --git a/C4/Search.pm b/C4/Search.pm >index ba559e8..16ca641 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1206,7 +1206,6 @@ sub parseQuery { > $query .= " #$modifier"; > } > } >- > $query_desc = $query; > $query_desc =~ s/\s+/ /g; > if ( C4::Context->preference("QueryWeightFields") ) { >@@ -1252,7 +1251,6 @@ sub buildQuery { > > my $query_desc; > ( $operators, $operands, $indexes, $limits, $sort_by, $scan, $lang, $query_desc) = parseQuery($operators, $operands, $indexes, $limits, $sort_by, $scan, $lang); >- > # dereference > my @operators = $operators ? @$operators : (); > my @indexes = $indexes ? @$indexes : (); >@@ -1607,6 +1605,7 @@ sub buildQuery { > warn "LIMIT DESC:" . $limit_desc; > warn "---------\nLeave buildQuery\n---------"; > } >+ utf8::decode($query_desc); > return ( > undef, $query, $simple_query, $query_cgi, > $query_desc, $limit, $limit_cgi, $limit_desc, >diff --git a/C4/Templates.pm b/C4/Templates.pm >index b4f68ca..342240c 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -124,15 +124,7 @@ sub output { > utf8_hashref($vars->{$k}); > } > else { >- 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}); >- } >+ utf8::upgrade($vars->{$k}) if utf8::is_utf8($vars->{$k}); > } > } > my $data; >diff --git a/members/member.pl b/members/member.pl >index 78b762f..a30b01b 100755 >--- a/members/member.pl >+++ b/members/member.pl >@@ -49,6 +49,9 @@ my ($template, $loggedinuser, $cookie) > my $theme = $input->param('theme') || "default"; > > my $patron = $input->Vars; >+my $tmp_member = $patron->{member}; >+utf8::decode($tmp_member); >+$patron->{member} = $tmp_member; > foreach (keys %$patron){ > delete $$patron{$_} unless($$patron{$_}); > } >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6554
:
4558
|
4560
|
4561
|
4562
|
4563
|
4564
|
5962
|
6041
|
6065
|
6070
|
6071
|
6072
|
6073
|
6076
|
6077
|
6078
|
6079
|
6080
|
6083
|
6084
|
6085
|
6108
|
10118
|
16780
|
16797
|
16857
|
16905
|
16929
|
16930
|
16931
|
16932
|
16960
|
16961
|
16962
|
16963
|
16964
|
16966
|
16968
|
16969
|
16984
|
16985
|
16986
|
16987
|
16988
|
16989
|
17179
|
17186
|
17187
|
17327
|
17328
|
18746
|
18747
|
18749
|
18750
|
21318
|
21399
|
21478
|
21488
|
21506
|
21509
|
21581
|
21629
|
21631
|
21632
|
21682
|
21937
|
21955
|
21978
|
21980
|
21981
|
23107
|
23140