diff options
| author | David Leadbeater | 2014-08-13 20:40:50 +0100 |
|---|---|---|
| committer | David Leadbeater | 2014-08-13 20:40:50 +0100 |
| commit | 06cc2a9c8278b6fb72c1b33226229cf7abe01027 (patch) | |
| tree | 3a4027427d37a1b2497bf6d9d49e632292ebafcf | |
| parent | d57d74d527b02d82ba2213cb89eae7076d822c79 (diff) | |
| download | scripts.irssi.org-06cc2a9c8278b6fb72c1b33226229cf7abe01027.tar.bz2 | |
Encode as UTF-8 when sending over the pipe
Fixes script error when the title has unicode in it.
| -rw-r--r-- | _data/scripts.yaml | 2 | ||||
| -rw-r--r-- | scripts/urlinfo.pl | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/_data/scripts.yaml b/_data/scripts.yaml index c173eca..af41d4d 100644 --- a/_data/scripts.yaml +++ b/_data/scripts.yaml @@ -4228,4 +4228,4 @@ modified: "2014-08-10" license: "WTFPL" name: "urlinfo" - version: "1.1" + version: "1.2" 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); } } |
