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/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 337-343 sub export_marc_records_from_sth { Link Here
337
                }
337
                }
338
            }
338
            }
339
            if ( $marcxml ) {
339
            if ( $marcxml ) {
340
                print OUT $marcxml if $marcxml;
340
                print {$fh} $marcxml if $marcxml;
341
                $num_exported++;
341
                $num_exported++;
342
            }
342
            }
343
            next;
343
            next;
Lines 350-356 sub export_marc_records_from_sth { Link Here
350
            # to care, though, at least if you're using the GRS-1 filter.  It does
350
            # to care, though, at least if you're using the GRS-1 filter.  It does
351
            # care if you're using the DOM filter, which requires valid XML file(s).
351
            # care if you're using the DOM filter, which requires valid XML file(s).
352
            eval {
352
            eval {
353
                print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
353
                print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
354
                $num_exported++;
354
                $num_exported++;
355
            };
355
            };
356
            if ($@) {
356
            if ($@) {
Lines 359-365 sub export_marc_records_from_sth { Link Here
359
        }
359
        }
360
    }
360
    }
361
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
361
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
362
    close OUT;
362
    close $fh;
363
    return $num_exported;
363
    return $num_exported;
364
}
364
}
365
365
Lines 367-373 sub export_marc_records_from_list { Link Here
367
    my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_;
367
    my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_;
368
368
369
    my $num_exported = 0;
369
    my $num_exported = 0;
370
    open (OUT, ">:utf8 ", "$directory/exported_records") or die $!;
370
    open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!;
371
    my $i = 0;
371
    my $i = 0;
372
372
373
    # Skip any deleted records. We check for this anyway, but this reduces error spam
373
    # Skip any deleted records. We check for this anyway, but this reduces error spam
Lines 384-395 sub export_marc_records_from_list { Link Here
384
            # strung together with no single root element.  zebraidx doesn't seem
384
            # strung together with no single root element.  zebraidx doesn't seem
385
            # to care, though, at least if you're using the GRS-1 filter.  It does
385
            # to care, though, at least if you're using the GRS-1 filter.  It does
386
            # care if you're using the DOM filter, which requires valid XML file(s).
386
            # care if you're using the DOM filter, which requires valid XML file(s).
387
            print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
387
            print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
388
            $num_exported++;
388
            $num_exported++;
389
        }
389
        }
390
    }
390
    }
391
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
391
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
392
    close OUT;
392
    close $fh;
393
    return $num_exported;
393
    return $num_exported;
394
}
394
}
395
395
Lines 397-403 sub generate_deleted_marc_records { Link Here
397
    my ($record_type, $entries, $directory, $as_xml) = @_;
397
    my ($record_type, $entries, $directory, $as_xml) = @_;
398
398
399
    my $records_deleted = {};
399
    my $records_deleted = {};
400
    open (OUT, ">:utf8 ", "$directory/exported_records") or die $!;
400
    open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!;
401
    my $i = 0;
401
    my $i = 0;
402
    foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) {
402
    foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) {
403
        print "\r$i" unless ($i++ %100 or !$verbose_logging);
403
        print "\r$i" unless ($i++ %100 or !$verbose_logging);
Lines 413-424 sub generate_deleted_marc_records { Link Here
413
            fix_unimarc_100($marc);
413
            fix_unimarc_100($marc);
414
        }
414
        }
415
415
416
        print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc();
416
        print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc();
417
417
418
        $records_deleted->{$record_number} = 1;
418
        $records_deleted->{$record_number} = 1;
419
    }
419
    }
420
    print "\nRecords exported: $i\n" if ( $verbose_logging );
420
    print "\nRecords exported: $i\n" if ( $verbose_logging );
421
    close OUT;
421
    close $fh;
422
    return $records_deleted;
422
    return $records_deleted;
423
    
423
    
424
424
Lines 824-831 if ($authorities) { Link Here
824
    # AUTHORITIES : copying mandatory files
824
    # AUTHORITIES : copying mandatory files
825
    #
825
    #
826
    unless (-f C4::Context->zebraconfig('authorityserver')->{config}) {
826
    unless (-f C4::Context->zebraconfig('authorityserver')->{config}) {
827
    open ZD,">:utf8 ",C4::Context->zebraconfig('authorityserver')->{config};
827
    open my $zd, '>:encoding(UTF-8)' ,C4::Context->zebraconfig('authorityserver')->{config};
828
    print ZD "
828
    print {$zd} "
829
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl 
829
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl 
830
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
830
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
831
831
Lines 969-976 if ($biblios) { Link Here
969
    # BIBLIOS : copying mandatory files
969
    # BIBLIOS : copying mandatory files
970
    #
970
    #
971
    unless (-f C4::Context->zebraconfig('biblioserver')->{config}) {
971
    unless (-f C4::Context->zebraconfig('biblioserver')->{config}) {
972
    open ZD,">:utf8 ",C4::Context->zebraconfig('biblioserver')->{config};
972
    open my $zd, '>:encoding(UTF-8)', C4::Context->zebraconfig('biblioserver')->{config};
973
    print ZD "
973
    print {$zd} "
974
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl 
974
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl 
975
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
975
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
976
976
(-)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