summaryrefslogtreecommitdiffstats
path: root/scripts/urlinfo.pl
diff options
context:
space:
mode:
authorDavid Leadbeater2014-08-13 20:40:50 +0100
committerDavid Leadbeater2014-08-13 20:40:50 +0100
commit06cc2a9c8278b6fb72c1b33226229cf7abe01027 (patch)
tree3a4027427d37a1b2497bf6d9d49e632292ebafcf /scripts/urlinfo.pl
parentd57d74d527b02d82ba2213cb89eae7076d822c79 (diff)
downloadscripts.irssi.org-06cc2a9c8278b6fb72c1b33226229cf7abe01027.tar.bz2
Encode as UTF-8 when sending over the pipe
Fixes script error when the title has unicode in it.
Diffstat (limited to 'scripts/urlinfo.pl')
-rw-r--r--scripts/urlinfo.pl9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/urlinfo.pl b/scripts/urlinfo.pl
index 8715ebb..0a86fe1 100644
--- a/scripts/urlinfo.pl
+++ b/scripts/urlinfo.pl
@@ -1,9 +1,10 @@
use 5.014;
use utf8;
+use Encode;
use Irssi;
use POSIX ();
-our $VERSION = "1.1";
+our $VERSION = "1.2";
our %IRSSI = (
authors => 'David Leadbeater',
contact => 'dgl@dgl.cx',
@@ -242,10 +243,10 @@ sub msg {
fork_wrapper(sub { # Child
my($fh) = @_;
- syswrite $fh, " " . get_info($site, $uri);
+ syswrite $fh, " " . encode_utf8(get_info($site, $uri));
},
sub { # Parent
- my($in) = @_;
+ my $in = decode_utf8($_[0]);
if ($in =~ s/^- //) {
print "\x{3}4urlinfo error:\x{3} $in";
return;
@@ -325,7 +326,7 @@ sub fork_wrapper {
$child->($wfh);
};
alarm 0;
- syswrite $wfh, "- $@" if $@;
+ syswrite $wfh, encode_utf8("- $@") if $@;
POSIX::_exit(1);
}
}