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

(-)a/C4/Context.pm (-1 / +3 lines)
Lines 942-948 set_userenv is called in Auth.pm Link Here
942
942
943
#'
943
#'
944
sub set_userenv {
944
sub set_userenv {
945
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter)= @_;
945
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter)= 
946
	map { utf8::decode($_); $_ } # CGI::Session doesn't handle utf-8, so we decode it here
947
	@_;
946
    my $var=$context->{"activeuser"};
948
    my $var=$context->{"activeuser"};
947
    my $cell = {
949
    my $cell = {
948
        "number"     => $usernum,
950
        "number"     => $usernum,
(-)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 (+4 lines)
Lines 265-270 sub SimpleSearch { Link Here
265
265
266
                for my $j ( $first_record..$last_record ) {
266
                for my $j ( $first_record..$last_record ) {
267
                    my $record = $tmpresults[ $i - 1 ]->record( $j-1 )->raw(); # 0 indexed
267
                    my $record = $tmpresults[ $i - 1 ]->record( $j-1 )->raw(); # 0 indexed
268
                    utf8::decode( $record );
268
                    push @{$results}, $record;
269
                    push @{$results}, $record;
269
                }
270
                }
270
            }
271
            }
Lines 456-461 sub getRecords { Link Here
456
                    # not an index scan
457
                    # not an index scan
457
                    else {
458
                    else {
458
                        $record = $results[ $i - 1 ]->record($j)->raw();
459
                        $record = $results[ $i - 1 ]->record($j)->raw();
460
                        utf8::decode( $record );
459
461
460
                        # warn "RECORD $j:".$record;
462
                        # warn "RECORD $j:".$record;
461
                        $results_hash->{'RECORDS'}[$j] = $record;
463
                        $results_hash->{'RECORDS'}[$j] = $record;
Lines 476-481 sub getRecords { Link Here
476
478
477
		                for ( my $j = 0 ; $j < $jmax ; $j++ ) {
479
		                for ( my $j = 0 ; $j < $jmax ; $j++ ) {
478
		                    my $render_record = $results[ $i - 1 ]->record($j)->render();
480
		                    my $render_record = $results[ $i - 1 ]->record($j)->render();
481
		                    utf8::decode($render_record);
479
                            my @used_datas = ();
482
                            my @used_datas = ();
480
483
481
                            foreach my $fcode (@fcodes) {
484
                            foreach my $fcode (@fcodes) {
Lines 640-645 sub pazGetRecords { Link Here
640
        for (my $i = 0; $i < $count; $i++) {
643
        for (my $i = 0; $i < $count; $i++) {
641
            # FIXME -- may need to worry about diacritics here
644
            # FIXME -- may need to worry about diacritics here
642
            my $rec = $paz->record($recid, $i);
645
            my $rec = $paz->record($recid, $i);
646
            utf8::decode( $rec );
643
            push @{ $result_group->{'RECORDS'} }, $rec;
647
            push @{ $result_group->{'RECORDS'} }, $rec;
644
        }
648
        }
645
649
(-)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
(-)a/admin/preferences.pl (+1 lines)
Lines 34-39 use File::Spec; Link Here
34
use IO::File;
34
use IO::File;
35
use YAML::Syck qw();
35
use YAML::Syck qw();
36
$YAML::Syck::ImplicitTyping = 1;
36
$YAML::Syck::ImplicitTyping = 1;
37
$YAML::Syck::ImplicitUnicode = 1; # force utf-8 for preference encoding
37
our $lang;
38
our $lang;
38
39
39
# use Smart::Comments;
40
# use Smart::Comments;
(-)a/admin/z3950servers.pl (-1 / +1 lines)
Lines 21-27 Link Here
21
21
22
use strict;
22
use strict;
23
#use warnings; FIXME - Bug 2505
23
#use warnings; FIXME - Bug 2505
24
use CGI;
24
use CGI qw( -utf8 );
25
use C4::Context;
25
use C4::Context;
26
use C4::Auth;
26
use C4::Auth;
27
use C4::Output;
27
use C4::Output;
(-)a/catalogue/search.pl (-1 / +1 lines)
Lines 154-160 use C4::Branch; # GetBranches Link Here
154
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
154
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
155
# create a new CGI object
155
# create a new CGI object
156
# FIXME: no_undef_params needs to be tested
156
# FIXME: no_undef_params needs to be tested
157
use CGI qw('-no_undef_params');
157
use CGI qw( -no_undef_params -utf8 );
158
my $cgi = new CGI;
158
my $cgi = new CGI;
159
159
160
my ($template,$borrowernumber,$cookie);
160
my ($template,$borrowernumber,$cookie);
(-)a/cataloguing/z3950_search.pl (-1 / +1 lines)
Lines 20-26 Link Here
20
20
21
use strict;
21
use strict;
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
use CGI;
23
use CGI qw( -utf8 );
24
24
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Output;
26
use C4::Output;
(-)a/members/member.pl (-1 / +1 lines)
Lines 27-33 use strict; Link Here
27
#use warnings; FIXME - Bug 2505
27
#use warnings; FIXME - Bug 2505
28
use C4::Auth;
28
use C4::Auth;
29
use C4::Output;
29
use C4::Output;
30
use CGI;
30
use CGI qw( -utf8 );
31
use C4::Members;
31
use C4::Members;
32
use C4::Branch;
32
use C4::Branch;
33
use C4::Category;
33
use C4::Category;
(-)a/opac/opac-search.pl (-1 / +1 lines)
Lines 44-50 use Storable qw(thaw freeze); Link Here
44
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
44
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
45
# create a new CGI object
45
# create a new CGI object
46
# FIXME: no_undef_params needs to be tested
46
# FIXME: no_undef_params needs to be tested
47
use CGI qw('-no_undef_params');
47
use CGI qw( -no_undef_params -utf8 );
48
my $cgi = new CGI;
48
my $cgi = new CGI;
49
49
50
BEGIN {
50
BEGIN {

Return to bug 6554