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

(-)a/admin/aqplan.pl (-1 / +1 lines)
Lines 463-469 output_html_with_http_headers $input, $cookie, $template->output; Link Here
463
sub _print_to_csv {
463
sub _print_to_csv {
464
    my ( $header, $results ) = @_;
464
    my ( $header, $results ) = @_;
465
465
466
    binmode STDOUT, ":encoding(UTF-8)";
466
    binmode STDOUT, ':encoding(UTF-8)';
467
467
468
    my $csv = Text::CSV_XS->new(
468
    my $csv = Text::CSV_XS->new(
469
        {   sep_char     => $del,
469
        {   sep_char     => $del,
(-)a/authorities/authorities-list.pl (-1 / +1 lines)
Lines 4-10 use warnings; Link Here
4
use C4::Context;
4
use C4::Context;
5
use C4::AuthoritiesMarc;
5
use C4::AuthoritiesMarc;
6
use utf8;
6
use utf8;
7
use open qw( :std :utf8 );
7
use open qw[ :std :encoding(utf8) ];
8
8
9
my $dbh=C4::Context->dbh;
9
my $dbh=C4::Context->dbh;
10
my $datatypes_query = $dbh->prepare(<<ENDSQL);
10
my $datatypes_query = $dbh->prepare(<<ENDSQL);
(-)a/cataloguing/ysearch.pl (-1 / +1 lines)
Lines 39-45 my $field = $input->param('field'); Link Here
39
# Prevent from disclosing data
39
# Prevent from disclosing data
40
die() unless ($table eq "biblioitems"); 
40
die() unless ($table eq "biblioitems"); 
41
41
42
binmode STDOUT, ":utf8";
42
binmode STDOUT, ':encoding(UTF-8)';
43
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
43
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
44
44
45
my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { cataloguing => '*' } );
45
my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { cataloguing => '*' } );
(-)a/misc/cronjobs/MARC21_parse_test.pl (-1 / +1 lines)
Lines 24-30 use MARC::Record; Link Here
24
use MARC::File::XML;
24
use MARC::File::XML;
25
use MARC::File::USMARC;
25
use MARC::File::USMARC;
26
26
27
use open OUT => ':utf8';
27
use open OUT => ':encoding(UTF-8)';
28
28
29
use Getopt::Long qw(:config auto_help auto_version);
29
use Getopt::Long qw(:config auto_help auto_version);
30
use Pod::Usage;
30
use Pod::Usage;
(-)a/misc/cronjobs/overdue_notices.pl (-1 / +1 lines)
Lines 323-329 if (@branchcodes) { Link Here
323
# these are the fields that will be substituted into <<item.content>>
323
# these are the fields that will be substituted into <<item.content>>
324
my @item_content_fields = split( /,/, $itemscontent );
324
my @item_content_fields = split( /,/, $itemscontent );
325
325
326
binmode( STDOUT, ":utf8" );
326
binmode STDOUT, ':encoding(UTF-8)';
327
327
328
328
329
our $csv;       # the Text::CSV_XS object
329
our $csv;       # the Text::CSV_XS object
(-)a/misc/migration_tools/22_to_30/export_Authorities_xml.pl (-3 / +3 lines)
Lines 23-29 $rq->execute; Link Here
23
#ATTENTION : Mettre la base en utf8 auparavant.
23
#ATTENTION : Mettre la base en utf8 auparavant.
24
#BEWARE : Set database into utf8 before.
24
#BEWARE : Set database into utf8 before.
25
while (my ($authid)=$rq->fetchrow){
25
while (my ($authid)=$rq->fetchrow){
26
open FILEOUTPUT,">:utf8", "./$filename/$authid.xml" or die "unable to open $filename";
26
open my $fileoutput, '>:encoding(UTF-8)', "./$filename/$authid.xml" or die "unable to open $filename";
27
  my $record=AUTHgetauthority($dbh,$authid);
27
  my $record=AUTHgetauthority($dbh,$authid);
28
  if (! utf8::is_utf8($record)) {
28
  if (! utf8::is_utf8($record)) {
29
    utf8::decode($record);
29
    utf8::decode($record);
Lines 44-50 open FILEOUTPUT,">:utf8", "./$filename/$authid.xml" or die "unable to open $file Link Here
44
     # } else {
44
     # } else {
45
#    $record->encoding( 'UTF-8' );
45
#    $record->encoding( 'UTF-8' );
46
#  }
46
#  }
47
  print FILEOUTPUT $record->as_xml();
47
  print {$fileoutput}  $record->as_xml();
48
close FILEOUPUT;
48
close $fileoutput;
49
49
50
}
50
}
(-)a/misc/migration_tools/bulkmarcimport.pl (-1 / +1 lines)
Lines 30-36 use Getopt::Long; Link Here
30
use IO::File;
30
use IO::File;
31
use Pod::Usage;
31
use Pod::Usage;
32
32
33
binmode(STDOUT, ":utf8");
33
binmode STDOUT, ':encoding(UTF-8)';
34
my ( $input_marc_file, $number, $offset) = ('',0,0);
34
my ( $input_marc_file, $number, $offset) = ('',0,0);
35
my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format,$biblios,$authorities,$keepids,$match, $isbn_check, $logfile);
35
my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format,$biblios,$authorities,$keepids,$match, $isbn_check, $logfile);
36
my ($sourcetag,$sourcesubfield,$idmapfl);
36
my ($sourcetag,$sourcesubfield,$idmapfl);
(-)a/misc/migration_tools/rebuild_zebra.pl (-14 / +14 lines)
Lines 309-315 sub export_marc_records_from_sth { Link Here
309
    my ($record_type, $sth, $directory, $as_xml, $noxml, $nosanitize) = @_;
309
    my ($record_type, $sth, $directory, $as_xml, $noxml, $nosanitize) = @_;
310
310
311
    my $num_exported = 0;
311
    my $num_exported = 0;
312
    open (OUT, ">:utf8 ", "$directory/exported_records") or die $!;
312
    open my $fh, '>:encoding(UTF-8) ', "$directory/exported_records" or die $!;
313
    my $i = 0;
313
    my $i = 0;
314
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",'');
314
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",'');
315
    while (my ($record_number) = $sth->fetchrow_array) {
315
    while (my ($record_number) = $sth->fetchrow_array) {
Lines 339-345 sub export_marc_records_from_sth { Link Here
339
                }
339
                }
340
            }
340
            }
341
            if ( $marcxml ) {
341
            if ( $marcxml ) {
342
                print OUT $marcxml if $marcxml;
342
                print {$fh} $marcxml if $marcxml;
343
                $num_exported++;
343
                $num_exported++;
344
            }
344
            }
345
            next;
345
            next;
Lines 352-358 sub export_marc_records_from_sth { Link Here
352
            # to care, though, at least if you're using the GRS-1 filter.  It does
352
            # to care, though, at least if you're using the GRS-1 filter.  It does
353
            # care if you're using the DOM filter, which requires valid XML file(s).
353
            # care if you're using the DOM filter, which requires valid XML file(s).
354
            eval {
354
            eval {
355
                print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
355
                print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
356
                $num_exported++;
356
                $num_exported++;
357
            };
357
            };
358
            if ($@) {
358
            if ($@) {
Lines 361-367 sub export_marc_records_from_sth { Link Here
361
        }
361
        }
362
    }
362
    }
363
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
363
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
364
    close OUT;
364
    close $fh;
365
    return $num_exported;
365
    return $num_exported;
366
}
366
}
367
367
Lines 369-375 sub export_marc_records_from_list { Link Here
369
    my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_;
369
    my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_;
370
370
371
    my $num_exported = 0;
371
    my $num_exported = 0;
372
    open (OUT, ">:utf8 ", "$directory/exported_records") or die $!;
372
    open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!;
373
    my $i = 0;
373
    my $i = 0;
374
374
375
    # Skip any deleted records. We check for this anyway, but this reduces error spam
375
    # Skip any deleted records. We check for this anyway, but this reduces error spam
Lines 386-397 sub export_marc_records_from_list { Link Here
386
            # strung together with no single root element.  zebraidx doesn't seem
386
            # strung together with no single root element.  zebraidx doesn't seem
387
            # to care, though, at least if you're using the GRS-1 filter.  It does
387
            # to care, though, at least if you're using the GRS-1 filter.  It does
388
            # care if you're using the DOM filter, which requires valid XML file(s).
388
            # care if you're using the DOM filter, which requires valid XML file(s).
389
            print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
389
            print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
390
            $num_exported++;
390
            $num_exported++;
391
        }
391
        }
392
    }
392
    }
393
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
393
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
394
    close OUT;
394
    close $fh;
395
    return $num_exported;
395
    return $num_exported;
396
}
396
}
397
397
Lines 399-405 sub generate_deleted_marc_records { Link Here
399
    my ($record_type, $entries, $directory, $as_xml) = @_;
399
    my ($record_type, $entries, $directory, $as_xml) = @_;
400
400
401
    my $records_deleted = {};
401
    my $records_deleted = {};
402
    open (OUT, ">:utf8 ", "$directory/exported_records") or die $!;
402
    open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!;
403
    my $i = 0;
403
    my $i = 0;
404
    foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) {
404
    foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) {
405
        print "\r$i" unless ($i++ %100 or !$verbose_logging);
405
        print "\r$i" unless ($i++ %100 or !$verbose_logging);
Lines 415-426 sub generate_deleted_marc_records { Link Here
415
            fix_unimarc_100($marc);
415
            fix_unimarc_100($marc);
416
        }
416
        }
417
417
418
        print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc();
418
        print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc();
419
419
420
        $records_deleted->{$record_number} = 1;
420
        $records_deleted->{$record_number} = 1;
421
    }
421
    }
422
    print "\nRecords exported: $i\n" if ( $verbose_logging );
422
    print "\nRecords exported: $i\n" if ( $verbose_logging );
423
    close OUT;
423
    close $fh;
424
    return $records_deleted;
424
    return $records_deleted;
425
    
425
    
426
426
Lines 825-832 if ($authorities) { Link Here
825
    # AUTHORITIES : copying mandatory files
825
    # AUTHORITIES : copying mandatory files
826
    #
826
    #
827
    unless (-f C4::Context->zebraconfig('authorityserver')->{config}) {
827
    unless (-f C4::Context->zebraconfig('authorityserver')->{config}) {
828
    open ZD,">:utf8 ",C4::Context->zebraconfig('authorityserver')->{config};
828
    open my $zd, '>:encoding(UTF-8)' ,C4::Context->zebraconfig('authorityserver')->{config};
829
    print ZD "
829
    print {$zd} "
830
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl 
830
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl 
831
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
831
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
832
832
Lines 970-977 if ($biblios) { Link Here
970
    # BIBLIOS : copying mandatory files
970
    # BIBLIOS : copying mandatory files
971
    #
971
    #
972
    unless (-f C4::Context->zebraconfig('biblioserver')->{config}) {
972
    unless (-f C4::Context->zebraconfig('biblioserver')->{config}) {
973
    open ZD,">:utf8 ",C4::Context->zebraconfig('biblioserver')->{config};
973
    open my $zd, '>:encoding(UTF-8)', C4::Context->zebraconfig('biblioserver')->{config};
974
    print ZD "
974
    print {$zd} "
975
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl 
975
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl 
976
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
976
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
977
977
(-)a/misc/sax_parser_test.pl (-1 / +1 lines)
Lines 9-15 use Encode; Link Here
9
my $parser = XML::SAX::ParserFactory->parser(
9
my $parser = XML::SAX::ParserFactory->parser(
10
Handler => MySAXHandler->new
10
Handler => MySAXHandler->new
11
);
11
);
12
binmode STDOUT, ":utf8";
12
binmode STDOUT, ':encoding(UTF-8)';
13
print "\x{65}\x{301}\n";
13
print "\x{65}\x{301}\n";
14
$parser->parse_string(encode_utf8("<xml>\x{65}\x{301}</xml>"));
14
$parser->parse_string(encode_utf8("<xml>\x{65}\x{301}</xml>"));
15
$parser->parse_string("<xml>\xEF\xBB\xBF\x{65}\x{301}</xml>");
15
$parser->parse_string("<xml>\xEF\xBB\xBF\x{65}\x{301}</xml>");
(-)a/misc/translator/xgettext.pl (-1 / +1 lines)
Lines 351-357 if (defined $output && $output ne '-') { Link Here
351
    print STDERR "$0: Outputting to STDOUT...\n" if $verbose_p;
351
    print STDERR "$0: Outputting to STDOUT...\n" if $verbose_p;
352
    open(OUTPUT, ">&STDOUT");
352
    open(OUTPUT, ">&STDOUT");
353
}
353
}
354
#binmode( OUTPUT, ":utf8" );
354
binmode OUTPUT, ':encoding(UTF-8)';
355
355
356
if (defined $files_from) {
356
if (defined $files_from) {
357
    print STDERR "$0: Opening input file list \"$files_from\"\n" if $verbose_p;
357
    print STDERR "$0: Opening input file list \"$files_from\"\n" if $verbose_p;
(-)a/opac/ilsdi.pl (-1 / +1 lines)
Lines 228-234 if ( $service and any { $service eq $_ } @services ) { Link Here
228
}
228
}
229
229
230
# Output XML by passing the hashref to XMLOut
230
# Output XML by passing the hashref to XMLOut
231
binmode(STDOUT, ":utf8");
231
binmode STDOUT, ':encoding(UTF-8)';
232
print CGI::header('-type'=>'text/xml', '-charset'=>'utf-8');
232
print CGI::header('-type'=>'text/xml', '-charset'=>'utf-8');
233
print XMLout(
233
print XMLout(
234
    $out,
234
    $out,
(-)a/opac/oai.pl (-1 / +1 lines)
Lines 41-47 else { Link Here
41
    );
41
    );
42
}
42
}
43
43
44
binmode( STDOUT, ":utf8" );
44
binmode STDOUT, ':encoding(UTF-8)';
45
my $repository = C4::OAI::Repository->new();
45
my $repository = C4::OAI::Repository->new();
46
46
47
# __END__ Main Prog
47
# __END__ Main Prog
(-)a/reports/guided_reports.pl (-1 / +1 lines)
Lines 539-545 elsif ($phase eq 'Run this report'){ Link Here
539
}
539
}
540
540
541
elsif ($phase eq 'Export'){
541
elsif ($phase eq 'Export'){
542
    binmode STDOUT, ':utf8';
542
    binmode STDOUT, ':encoding(UTF-8)';
543
543
544
	# export results to tab separated text or CSV
544
	# export results to tab separated text or CSV
545
	my $sql    = $input->param('sql');  # FIXME: use sql from saved report ID#, not new user-supplied SQL!
545
	my $sql    = $input->param('sql');  # FIXME: use sql from saved report ID#, not new user-supplied SQL!
(-)a/reports/serials_stats.pl (-1 / +1 lines)
Lines 103-109 if($do_it){ Link Here
103
        $template->param(datas => \@datas,
103
        $template->param(datas => \@datas,
104
                         do_it => 1);
104
                         do_it => 1);
105
    }else{
105
    }else{
106
        binmode STDOUT, ':utf8';
106
        binmode STDOUT, ':encoding(UTF-8)';
107
        print $input->header(-type => 'application/vnd.sun.xml.calc',
107
        print $input->header(-type => 'application/vnd.sun.xml.calc',
108
                         -encoding => 'utf-8',
108
                         -encoding => 'utf-8',
109
                             -name => "$basename.csv",
109
                             -name => "$basename.csv",
(-)a/svc/bib (-1 / +1 lines)
Lines 27-33 use C4::Biblio; Link Here
27
use XML::Simple;
27
use XML::Simple;
28
28
29
my $query = new CGI;
29
my $query = new CGI;
30
binmode STDOUT, ":utf8";
30
binmode STDOUT, ':encoding(UTF-8)';
31
31
32
my ($status, $cookie, $sessionID) = check_api_auth($query, { editcatalogue => 'edit_catalogue'} );
32
my ($status, $cookie, $sessionID) = check_api_auth($query, { editcatalogue => 'edit_catalogue'} );
33
unless ($status eq "ok") {
33
unless ($status eq "ok") {
(-)a/svc/new_bib (-1 / +1 lines)
Lines 28-34 use XML::Simple; Link Here
28
use C4::Charset;
28
use C4::Charset;
29
29
30
my $query = new CGI;
30
my $query = new CGI;
31
binmode STDOUT, ":utf8";
31
binmode STDOUT, ':encoding(UTF-8)';
32
32
33
my ($status, $cookie, $sessionID) = check_api_auth($query, { editcatalogue => 'edit_catalogue'} );
33
my ($status, $cookie, $sessionID) = check_api_auth($query, { editcatalogue => 'edit_catalogue'} );
34
unless ($status eq "ok") {
34
unless ($status eq "ok") {
(-)a/t/db_dependent/lib/KohaTest.pm (-3 / +3 lines)
Lines 625-635 sub reindex_marc { Link Here
625
        mkdir "$directory/$record_type";
625
        mkdir "$directory/$record_type";
626
        my $sth = $dbh->prepare($record_type eq "biblio" ? "SELECT marc FROM biblioitems" : "SELECT marc FROM auth_header");
626
        my $sth = $dbh->prepare($record_type eq "biblio" ? "SELECT marc FROM biblioitems" : "SELECT marc FROM auth_header");
627
        $sth->execute();
627
        $sth->execute();
628
        open OUT, ">:utf8", "$directory/$record_type/records";
628
        open my $out, '>:encoding(UTF-8)', "$directory/$record_type/records";
629
        while (my ($blob) = $sth->fetchrow_array) {
629
        while (my ($blob) = $sth->fetchrow_array) {
630
            print OUT $blob;
630
            print {$out} $blob;
631
        }
631
        }
632
        close OUT;
632
        close $out;
633
        my $zebra_server = "${record_type}server";
633
        my $zebra_server = "${record_type}server";
634
        my $zebra_config  = C4::Context->zebraconfig($zebra_server)->{'config'};
634
        my $zebra_config  = C4::Context->zebraconfig($zebra_server)->{'config'};
635
        my $zebra_db_dir  = C4::Context->zebraconfig($zebra_server)->{'directory'};
635
        my $zebra_db_dir  = C4::Context->zebraconfig($zebra_server)->{'directory'};
(-)a/tools/export.pl (-2 / +1 lines)
Lines 56-62 my ($template, $loggedinuser, $cookie) Link Here
56
	}
56
	}
57
57
58
if ($op eq "export") {
58
if ($op eq "export") {
59
    binmode(STDOUT,":utf8");
59
    binmode STDOUT, ':encoding(UTF-8)';
60
	print $query->header(   -type => 'application/octet-stream', 
60
	print $query->header(   -type => 'application/octet-stream', 
61
                            -charset => 'utf-8',
61
                            -charset => 'utf-8',
62
                            -attachment=>$filename);
62
                            -attachment=>$filename);
63
- 

Return to bug 6752