From 263b115f15d0a50f7423b5a3ea5b5847cafa6083 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 25 Jul 2011 23:12:20 +0000 Subject: utf-8 support diff --git a/rhimport-dn b/rhimport-dn index 28941d5..d77c724 100755 --- a/rhimport-dn +++ b/rhimport-dn @@ -44,6 +44,10 @@ my $STAT_FILE = $ENV{'HOME'} . "/rhimport-dn.stat"; my $RSS_URL = "http://www.democracynow.org/podcast.xml"; my @PV_SCRIPT = ('/usr/bin/ssh', 'root@intranet', 'addnote', '111'); +binmode(STDIN, ":utf8"); +binmode(STDOUT, ":utf8"); +binmode(STDERR, ":utf8"); + my $user = `/usr/bin/id -un`; $user =~ s/\n//; my $group = "democracyn"; @@ -113,6 +117,9 @@ for my $entry ($feed->entries) { $writer->autoflush(1); local $SIG{CHLD} = 'DEFAULT'; my $pid = open3($writer, $reader, $error, @PV_SCRIPT); + binmode($reader, ":utf8"); + binmode($writer, ":utf8"); + binmode($error, ":utf8"); print $writer $sum_title . "\n" . $sum_text; close $writer; waitpid $pid, 0; @@ -121,7 +128,6 @@ for my $entry ($feed->entries) { print "STDERR:\n" . join('', <$error>) . "\n"; print "STDOUT:\n" . join('', <$reader>) . "\n"; } else { - print "\nPV: note added successfully"; print join('', <$reader>) . "\n"; } print "\n"; -- cgit v0.10.2