Bug 6371 - Item Types description not properly displayed if not pure ASCII
Summary: Item Types description not properly displayed if not pure ASCII
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: 3.6
Hardware: All All
: PATCH-Sent (DO NOT USE) normal (vote)
Assignee: Frédéric Demians
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-19 04:45 UTC by Frédéric Demians
Modified: 2012-10-25 23:10 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch (4.01 KB, patch)
2011-05-19 04:48 UTC, Frédéric Demians
Details | Diff | Splinter Review
Proposed patch (1.37 KB, patch)
2011-05-19 04:50 UTC, Frédéric Demians
Details | Diff | Splinter Review
Proposed patch (1.38 KB, patch)
2011-05-19 04:57 UTC, Frédéric Demians
Details | Diff | Splinter Review
signed off patch (1.62 KB, patch)
2011-05-21 16:02 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 6371 Item Types description not properly displayed if not pure ASCII (1.62 KB, patch)
2011-10-07 14:27 UTC, Paul Poulain
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Demians 2011-05-19 04:45:19 UTC
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?...

And you need to have at least one item type description containing
non ASCII characters.
Comment 1 Frédéric Demians 2011-05-19 04:48:21 UTC Comment hidden (obsolete)
Comment 2 Frédéric Demians 2011-05-19 04:50:03 UTC Comment hidden (obsolete)
Comment 3 Frédéric Demians 2011-05-19 04:57:31 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2011-05-21 16:02:01 UTC Comment hidden (obsolete)
Comment 5 Paul Poulain 2011-08-11 09:26:55 UTC
The problem exists, and the patch works, but i have a question about it.

Let me explain:

itemtypes are also accessed through C4/Koha.pm, sub GetItemTypes that is 
sub GetItemTypes {

    # returns a reference to a hash of references to itemtypes...
    my %itemtypes;
    my $dbh   = C4::Context->dbh;
    my $query = qq|
        SELECT *
        FROM   itemtypes
    |;
    my $sth = $dbh->prepare($query);
    $sth->execute;
    while ( my $IT = $sth->fetchrow_hashref ) {
        $itemtypes{ $IT->{'itemtype'} } = $IT;
    }
    return ( \%itemtypes );
}

As a reminder, the sub in C4/ItemTypes.pm is :

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 => {} },
    )};
}


I don't see any "utf8::encode" in the GetItemTypes, the sub is quite similar, except one uses selectall_arrayref, the other fetchrow_hashref. Why the hell is it needed to utf8::encode the ItemTypes.pm and not the GetItemTypes ?

What I fear is that the utf8::encode solves this problem, but another problem will happen later.
If anyone has an idea...
Comment 6 Frédéric Demians 2011-09-13 08:34:57 UTC
This bug is still here in Koha 3.4.4. The patch still apply and should be included in HEAD en 3.4 branches.
Comment 7 Paul Poulain 2011-10-07 14:27:02 UTC
Created attachment 5772 [details] [review]
Bug 6371 Item Types description not properly displayed if not pure ASCII

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?...

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
  - Fixes display probems in circulation alerts and 4xx UNIMARC plugin
  - display in other places looks ok with and without patch

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 8 Paul Poulain 2011-10-07 14:31:26 UTC
QA comment
  * good test plan
  * small patch
  * no code comment to do, it's only a few lines long
  * works as expected

=> passed QA
Comment 9 Chris Cormack 2011-10-08 07:18:28 UTC
Pushed please test
Comment 10 Frédéric Demians 2011-10-08 13:41:07 UTC
> Pushed please test

It works now in HEAD.