From: bw1 Date: Wed, 30 Jan 2019 17:12:38 +0000 (+0100) Subject: [upsidedown] utf8 X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=615f555bf5b3eabd82ce5b7b2c10b373de8b5fbe;p=irssi-scripts.irssi.org.git [upsidedown] utf8 --- diff --git a/scripts/upsidedown.pl b/scripts/upsidedown.pl index 2f60976..9142e90 100644 --- a/scripts/upsidedown.pl +++ b/scripts/upsidedown.pl @@ -3,13 +3,15 @@ # Irssi plugin to place text upside down # V0.1 - Initial script - Ivo Schooneman, 08-11-2012 # V0.2 - usay/ume - Ivo Schooneman, 08-11-2012 +# V0.3 - decode args 30-01-2019 # use strict; +use utf8; use Text::UpsideDown; use Irssi; use vars qw($VERSION %IRSSI); -$VERSION = "0.2"; +$VERSION = "0.3"; %IRSSI = ( authors => "Ivo Schooneman", contact => "ivo\@schooneman.net", @@ -22,6 +24,8 @@ $VERSION = "0.2"; sub ume { my ($text, $server, $dest) = @_; + utf8::decode($text); + # Check if connected to server if (!$server || !$server->{connected}) { Irssi::print("Not connected to server"); @@ -38,6 +42,8 @@ sub ume { sub usay { my ($text, $server, $dest) = @_; + utf8::decode($text); + # Check if connected to server if (!$server || !$server->{connected}) { Irssi::print("Not connected to server"); @@ -53,3 +59,10 @@ sub usay { Irssi::command_bind('usay', 'usay'); Irssi::command_bind('ume', 'ume'); + +if (Irssi::settings_get_str("term_charset") !~ m/utf/i ) { + Irssi::print("%RWarning%n %9$IRSSI{name}:%n no utf8 Terminal (". + Irssi::settings_get_str("term_charset").")",MSGLEVEL_CLIENTCRAP); +} + +# vim:set sw=4 ts=8: