Bug 11944: Fix encoding issue in C4::ItemType
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 14 May 2014 09:20:21 +0000 (11:20 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 13 Jan 2015 16:07:33 +0000 (13:07 -0300)
There is no need to encode strings coming from DB.

To reproduce:
go on admin/item_circulation_alerts.pl
The headers contain bad encoded characters.

Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/ItemType.pm
admin/item_circulation_alerts.pl

index cf61d40..3a15287 100644 (file)
@@ -82,7 +82,6 @@ sub all {
     for ( @{$dbh->selectall_arrayref(
         "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} )
     {
-        $_->{description} = Encode::encode('UTF-8', $_->{description});
         push @itypes, $class->new($_);
     }
     return @itypes;
@@ -105,9 +104,6 @@ sub get {
     my $data = $dbh->selectrow_hashref(
         "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype
     );
-    if ( $data->{description} ) {
-        $data->{description} = Encode::encode('UTF-8', $data->{description});
-    }
     return $class->new($data);
 }
 
index bed078c..d1018c1 100755 (executable)
@@ -35,15 +35,6 @@ use C4::Output;
 # shortcut for long package name
 our $preferences = 'C4::ItemCirculationAlertPreference';
 
-# utf8 filter
-sub utf8 {
-    my ($data, @keys) = @_;
-    for (@keys) {
-        $data->{$_} = decode('utf8', $data->{$_});
-    }
-    $data;
-}
-
 # prepend "br_" to column name and replace spaces with "<br/>"
 sub br {
     my ($data, @keys) = @_;