@@ -, +, @@ - removes all html_entity usages in tt file which hide utf8 bugs - removes all encode utf8 in tt plugins because we should get correctly marked data from DBIC and other sources directly (cf plugin EncodeUTF8 used in renew.tt) - adds some cleanup in C4::Templates::output: we now use perl utf8 file handler output so we don't need to decode tt variables manually. --- C4/Charset.pm | 2 +- C4/Templates.pm | 2 +- Koha/Template/Plugin/AuthorisedValues.pm | 5 +++-- Koha/Template/Plugin/Branches.pm | 4 ++-- Koha/Template/Plugin/EncodeUTF8.pm | 2 +- Koha/Template/Plugin/ItemTypes.pm | 2 +- cataloguing/addbiblio.pl | 2 +- koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt | 7 +++---- koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt | 2 +- koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) --- a/C4/Charset.pm +++ a/C4/Charset.pm @@ -560,7 +560,7 @@ sub _marc_marc8_to_utf8 { # occurs, upgrade the string in place. Moral of the story seems to be # that pack("U", ...) is better than chr(...) if you need to guarantee # that the resulting string is UTF-8. - utf8::upgrade($utf8sf); + Encode::encode('UTF-8', $utf8sf); } push @converted_subfields, $subfield->[0], $utf8sf; } --- a/C4/Templates.pm +++ a/C4/Templates.pm @@ -128,7 +128,7 @@ sub output { } } my $data; -# binmode( STDOUT, ":utf8" ); + binmode( STDOUT, ":utf8" ); $template->process( $self->filename, $vars, \$data ) || die "Template process failed: ", $template->error(); return $data; --- a/Koha/Template/Plugin/AuthorisedValues.pm +++ a/Koha/Template/Plugin/AuthorisedValues.pm @@ -22,7 +22,7 @@ use Modern::Perl; use Template::Plugin; use base qw( Template::Plugin ); -use Encode qw{encode decode}; +use Encode qw{encode is_utf8}; use C4::Koha; @@ -40,7 +40,8 @@ The parameters are identical to those used by the subroutine C4::Koha::GetAuthor sub GetByCode { my ( $self, $category, $code, $opac ) = @_; - return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) ); + my $av = GetAuthorisedValueByCode( $category, $code, $opac ); + return $av; } 1; --- a/Koha/Template/Plugin/Branches.pm +++ a/Koha/Template/Plugin/Branches.pm @@ -21,7 +21,7 @@ use Modern::Perl; use Template::Plugin; use base qw( Template::Plugin ); -use Encode qw{encode decode}; +use Encode qw{encode is_utf8}; use C4::Koha; use C4::Context; @@ -33,7 +33,7 @@ sub GetName { my $sth = C4::Context->dbh->prepare($query); $sth->execute($branchcode); my $b = $sth->fetchrow_hashref(); - return $b ? encode( 'UTF-8', $b->{'branchname'} ) : q{}; + return $b->{branchname}; } sub GetLoggedInBranchcode { --- a/Koha/Template/Plugin/EncodeUTF8.pm +++ a/Koha/Template/Plugin/EncodeUTF8.pm @@ -25,7 +25,7 @@ use Encode qw{encode}; sub filter { my ( $self, $value ) = @_; - return encode( 'UTF-8', $value ); + return is_utf8( $value ) ? encode( 'UTF-8', $value ) : $value; } 1; --- a/Koha/Template/Plugin/ItemTypes.pm +++ a/Koha/Template/Plugin/ItemTypes.pm @@ -32,7 +32,7 @@ sub GetDescription { my $sth = C4::Context->dbh->prepare($query); $sth->execute($itemtype); my $d = $sth->fetchrow_hashref(); - return encode( 'UTF-8', $d->{'description'} ); + return $d->{description} } --- a/cataloguing/addbiblio.pl +++ a/cataloguing/addbiblio.pl @@ -21,7 +21,7 @@ use strict; #use warnings; FIXME - Bug 2505 -use CGI; +use CGI q(-utf8); use C4::Output; use C4::Auth; use C4::Biblio; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -63,8 +63,8 @@

[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc @@ -4,7 +4,7 @@