[Koha-patches] [PATCH] Item Types description not properly displayed if not pure ASCII

Frédéric Demians f.demians at tamil.fr
Thu May 19 07:00:14 CEST 2011


In several places, C4::ItemType module is used to retrieve item types
and their description. If the description text contains non-ASCII
characters, those characters are not properly displayed.

This bug can be seen in:

  - 4xx plugin of a UNIMARC DB
  - Home > Admin > Item circulation alerts
  - others?...
---
 C4/ItemType.pm |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/C4/ItemType.pm b/C4/ItemType.pm
index e66d917..70d2690 100644
--- a/C4/ItemType.pm
+++ b/C4/ItemType.pm
@@ -73,12 +73,15 @@ C<description>.
 sub all {
     my ($class) = @_;
     my $dbh = C4::Context->dbh;
-    return    map { $class->new($_) }    @{$dbh->selectall_arrayref(
-        # The itemtypes table is small enough for
-        # `SELECT *` to be harmless.
-        "SELECT * FROM itemtypes ORDER BY description",
-        { Slice => {} },
-    )};
+
+    my @itypes;
+    for ( @{$dbh->selectall_arrayref(
+        "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} )
+    {
+        utf8::encode($_->{description});
+        push @itypes, $class->new($_);
+    }
+    return @itypes;
 }
 
 
-- 
1.7.5.1



More information about the Koha-patches mailing list