Permalink
Browse files

properly handle unicode strings

  • Loading branch information...
1 parent 0c40e6f commit a8f489178e6284e5e3b0ea2992a8b97b81f2b87f @darkstalker committed Apr 9, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 rnd_ebooks.pl
View
@@ -5,6 +5,7 @@
use Regexp::Common qw(URI);
use Config::Tiny;
use Net::Twitter;
+use Encode;
# source directory with pdf files
my $pdf_dir = "$ENV{HOME}/path_to_pdf_files";
@@ -28,7 +29,7 @@
print "selected file: $pdf_selected\n";
# extract raw text from pdf file
-my @lines = split "\n", `pdftotext "$pdf_selected" - 2> /dev/null`;
+my @lines = split "\n", decode('utf8', `pdftotext "$pdf_selected" - 2> /dev/null`);
sub trim { $_[0] =~ s/^\s+//; $_[0] =~ s/\s+$//; $_[0]; }

0 comments on commit a8f4891

Please sign in to comment.