fix support for cp1250 encoded files
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 23 Jun 2010 16:18:45 +0000 (18:18 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 23 Jun 2010 16:19:05 +0000 (18:19 +0200)
lib/MojoFacets/Import/CSV.pm

index d25d821..5a83884 100644 (file)
@@ -7,7 +7,7 @@ use base 'Mojo::Base';
 
 use File::Slurp;
 use Data::Dump qw(dump);
-#use Encode;
+use Encode;
 
 __PACKAGE__->attr('path');
 __PACKAGE__->attr('full_path');
@@ -17,7 +17,8 @@ sub data {
 
        my $path = $self->path;
 
-       my $data = read_file $self->full_path, { binmode => ':cp1250' }; # FIXME configurable!
+       my $data = read_file $self->full_path, { binmode => ':raw' }; # FIXME configurable!
+       $data = decode('cp1250', $data);
 
        my @lines = split(/\r?\n/, $data);
        $data = { items => [] };