View | Details | Raw Unified | Return to bug 6554
Collapse All | Expand All

(-)a/C4/ItemType.pm (-1 / +1 lines)
Lines 78-84 sub all { Link Here
78
    for ( @{$dbh->selectall_arrayref(
78
    for ( @{$dbh->selectall_arrayref(
79
        "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} )
79
        "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} )
80
    {
80
    {
81
        utf8::encode($_->{description});
81
#        utf8::encode($_->{description});
82
        push @itypes, $class->new($_);
82
        push @itypes, $class->new($_);
83
    }
83
    }
84
    return @itypes;
84
    return @itypes;
(-)a/C4/Output.pm (+1 lines)
Lines 301-306 sub output_with_http_headers($$$$;$) { Link Here
301
 
301
 
302
#    utf8::encode($data) if utf8::is_utf8($data);
302
#    utf8::encode($data) if utf8::is_utf8($data);
303
303
304
    binmode( STDOUT, ":utf8" );
304
    print $query->header($options), $data;
305
    print $query->header($options), $data;
305
}
306
}
306
307
(-)a/C4/Search.pm (+1 lines)
Lines 476-481 sub getRecords { Link Here
476
476
477
		                for ( my $j = 0 ; $j < $jmax ; $j++ ) {
477
		                for ( my $j = 0 ; $j < $jmax ; $j++ ) {
478
		                    my $render_record = $results[ $i - 1 ]->record($j)->render();
478
		                    my $render_record = $results[ $i - 1 ]->record($j)->render();
479
		                    utf8::decode($render_record);
479
                            my @used_datas = ();
480
                            my @used_datas = ();
480
481
481
                            foreach my $fcode (@fcodes) {
482
                            foreach my $fcode (@fcodes) {
(-)a/C4/Templates.pm (-41 / +2 lines)
Lines 63-68 sub new { Link Here
63
                "$htdocs/$theme/en/includes"
63
                "$htdocs/$theme/en/includes"
64
            ],
64
            ],
65
            FILTERS => {},
65
            FILTERS => {},
66
            ENCODING => 'utf8', # templates don't have BOM, see Template::FAQ
66
        }
67
        }
67
    ) or die Template->error();
68
    ) or die Template->error();
68
    my $self = {
69
    my $self = {
Lines 110-163 sub output { Link Here
110
    # and clean any utf8 mess
111
    # and clean any utf8 mess
111
    for my $k ( keys %{ $self->{VARS} } ) {
112
    for my $k ( keys %{ $self->{VARS} } ) {
112
        $vars->{$k} = $self->{VARS}->{$k};
113
        $vars->{$k} = $self->{VARS}->{$k};
113
        if (ref($vars->{$k}) eq 'ARRAY'){
114
            utf8_arrayref($vars->{$k});
115
        }
116
        elsif (ref($vars->{$k}) eq 'HASH'){
117
            utf8_hashref($vars->{$k});
118
        }
119
        else {
120
            utf8::encode($vars->{$k}) if utf8::is_utf8($vars->{$k});
121
        }
122
    }
114
    }
123
    my $data;
115
    my $data;
124
#    binmode( STDOUT, ":utf8" );
125
    $template->process( $self->filename, $vars, \$data )
116
    $template->process( $self->filename, $vars, \$data )
126
      || die "Template process failed: ", $template->error();
117
      || die "Template process failed: ", $template->error();
127
    return $data;
118
    return $data;
128
}
119
}
129
120
130
sub utf8_arrayref {
121
131
    my $arrayref = shift;
132
    foreach my $element (@$arrayref){
133
        if (ref($element) eq 'ARRAY'){
134
            utf8_arrayref($element);
135
            next;
136
        }
137
        if (ref($element) eq 'HASH'){
138
            utf8_hashref($element);
139
            next;
140
        }
141
        utf8::encode($element) if utf8::is_utf8($element);
142
    }        
143
}         
144
145
sub utf8_hashref {
146
    my $hashref = shift;
147
    for my $key (keys %{$hashref}){
148
        if (ref($hashref->{$key}) eq 'ARRAY'){
149
            utf8_arrayref($hashref->{$key});
150
            next;
151
        }
152
        if (ref($hashref->{$key}) eq 'HASH'){
153
            utf8_hashref($hashref->{$key});
154
            next;
155
        }
156
        utf8::encode($hashref->{$key}) if utf8::is_utf8($hashref->{$key});
157
    }
158
}
159
        
160
        
161
# FIXME - this is a horrible hack to cache
122
# FIXME - this is a horrible hack to cache
162
# the current known-good language, temporarily
123
# the current known-good language, temporarily
163
# put in place to resolve bug 4403.  It is
124
# put in place to resolve bug 4403.  It is
(-)a/C4/XSLT.pm (+1 lines)
Lines 176-181 sub XSLTParse4Display { Link Here
176
    }
176
    }
177
    my $results = $stylesheet->transform($source);
177
    my $results = $stylesheet->transform($source);
178
    my $newxmlrecord = $stylesheet->output_string($results);
178
    my $newxmlrecord = $stylesheet->output_string($results);
179
    utf8::decode( $newxmlrecord );
179
    return $newxmlrecord;
180
    return $newxmlrecord;
180
}
181
}
181
182

Return to bug 6554