Bugzilla – Attachment 6073 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]
remove unused code, cleanup ident and correctly mark templates as utf-8
6554-utf8-cleanup-v2.diff (text/plain), 4.28 KB, created by
Dobrica Pavlinusic
on 2011-10-27 11:03:04 UTC
(
hide
)
Description:
remove unused code, cleanup ident and correctly mark templates as utf-8
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2011-10-27 11:03:04 UTC
Size:
4.28 KB
patch
obsolete
>commit 51eb6042bd698c2870dd7280a0e2167efe2f45e1 >Author: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Mon Oct 24 19:26:43 2011 +0200 > > Bug 6554 - utf-8 cleanup v2 > > This patch tries to clean up utf-8 handling in Koha. > > In current implementation (removed in this patch) > uses heuristic to guess which strings need decoding from utf-8 > to binary representation and doesn't support utf-8 characters > in templates and has problems with utf-8 data from database. > > With this changes, Koha perl code always uses utf-8 encoding > correctly. All incomming data from database is allready > correctly marked as utf-8, and decoding of utf8 is required > only from Zebra and XSLT transfers which don't set utf-8 flag > correctly. > > For output, standard perl :utf8 handler is used removing various > "wide character" warnings as side-effect. > >diff --git a/C4/ItemType.pm b/C4/ItemType.pm >index 70d2690..d7c0615 100644 >--- a/C4/ItemType.pm >+++ b/C4/ItemType.pm >@@ -78,7 +78,7 @@ sub all { > for ( @{$dbh->selectall_arrayref( > "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} ) > { >- utf8::encode($_->{description}); >+# utf8::encode($_->{description}); > push @itypes, $class->new($_); > } > return @itypes; >diff --git a/C4/Output.pm b/C4/Output.pm >index 41a0a28..b256240 100644 >--- a/C4/Output.pm >+++ b/C4/Output.pm >@@ -301,6 +301,7 @@ sub output_with_http_headers($$$$;$) { > > # utf8::encode($data) if utf8::is_utf8($data); > >+ binmode( STDOUT, ":utf8" ); > print $query->header($options), $data; > } > >diff --git a/C4/Search.pm b/C4/Search.pm >index 98db887..45f792b 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -476,6 +476,7 @@ sub getRecords { > > for ( my $j = 0 ; $j < $jmax ; $j++ ) { > my $render_record = $results[ $i - 1 ]->record($j)->render(); >+ utf8::decode($render_record); > my @used_datas = (); > > foreach my $fcode (@fcodes) { >diff --git a/C4/Templates.pm b/C4/Templates.pm >index c2a5911..40e3ab6 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -63,6 +63,7 @@ sub new { > "$htdocs/$theme/en/includes" > ], > FILTERS => {}, >+ ENCODING => 'utf8', # templates don't have BOM, see Template::FAQ > } > ) or die Template->error(); > my $self = { >@@ -110,54 +111,14 @@ sub output { > # 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 ) > || die "Template process failed: ", $template->error(); > 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 >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 8bc4000..60d3f14 100755 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -176,6 +176,7 @@ sub XSLTParse4Display { > } > my $results = $stylesheet->transform($source); > my $newxmlrecord = $stylesheet->output_string($results); >+ utf8::decode( $newxmlrecord ); > return $newxmlrecord; > } >
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