projects
/
webpac2
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
force utf-8 encoding on all data comming from file
[webpac2]
/
lib
/
WebPAC
/
Input
/
CSV.pm
diff --git
a/lib/WebPAC/Input/CSV.pm
b/lib/WebPAC/Input/CSV.pm
index
112b9f0
..
7dcf582
100644
(file)
--- a/
lib/WebPAC/Input/CSV.pm
+++ b/
lib/WebPAC/Input/CSV.pm
@@
-7,6
+7,7
@@
use WebPAC::Input;
use base qw/WebPAC::Common/;
use Text::CSV;
use base qw/WebPAC::Common/;
use Text::CSV;
+use Encode;
use Data::Dump qw/dump/;
=head1 NAME
use Data::Dump qw/dump/;
=head1 NAME
@@
-15,7
+16,7
@@
WebPAC::Input::CSV - support for CSV Export Format
=cut
=cut
-our $VERSION = '0.0
1
';
+our $VERSION = '0.0
2
';
=head1 FUNCTIONS
=head1 FUNCTIONS
@@
-50,7
+51,7
@@
sub new {
my $log = $self->_get_logger();
my $log = $self->_get_logger();
- open( my $fh, '<:
encoding(utf-8)
', $arg->{path} ) || $log->logconfess("can't open $arg->{path}: $!");
+ open( my $fh, '<:
raw
', $arg->{path} ) || $log->logconfess("can't open $arg->{path}: $!");
my $csv = Text::CSV->new({ binary => 1 });
my $csv = Text::CSV->new({ binary => 1 });
@@
-66,7
+67,7
@@
sub new {
$rec->{'000'} = [ ++$self->{size} ];
my $col = 'A';
$rec->{'000'} = [ ++$self->{size} ];
my $col = 'A';
- $rec->{ $col++ } =
$_
foreach @$line;
+ $rec->{ $col++ } =
Encode::decode_utf8( $_ )
foreach @$line;
push @{ $self->{_rec} }, $rec;
push @{ $self->{_rec} }, $rec;
@@
-86,9
+87,7
@@
Return record with ID C<$mfn> from database
=cut
sub fetch_rec {
=cut
sub fetch_rec {
- my $self = shift;
-
- my ( $mfn, $filter_coderef ) = @_;
+ my ( $self, $mfn, $filter_coderef ) = @_;
return $self->{_rec}->[$mfn-1];
}
return $self->{_rec}->[$mfn-1];
}