]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
[pangotext] utf8
authorbw1 <redacted>
Sun, 18 Aug 2019 11:24:22 +0000 (13:24 +0200)
committerbw1 <redacted>
Mon, 19 Aug 2019 12:01:34 +0000 (14:01 +0200)
scripts/pangotext.pl

index e4dfb46accda290e6e9a47ee96e039519f4deb16..125a538a3d22a943086356c327059b2976e544f1 100644 (file)
@@ -44,8 +44,9 @@ use warnings;
 
 use Irssi;
 use Irssi::Irc;
+use utf8;
 
-our $VERSION = "1.1";
+our $VERSION = "1.2";
 our %IRSSI = (
     authors     => 'fprintf',
     contact     => 'fprintf@github.com',
@@ -102,6 +103,7 @@ my %tag_registry = (
     'inv' => \&inverse,
 );
 
+my $utf8;
 
 ##############################################################################################
 # Utils
@@ -234,6 +236,9 @@ sub pango {
     }
 
     return unless $dest;
+    if ($utf8) {
+        utf8::decode($text)
+    }
 
     if ($dest->{type} eq "CHANNEL" || $dest->{type} eq "QUERY") {
         $dest->command("/msg " . $dest->{name} . " " . render($text));
@@ -242,3 +247,7 @@ sub pango {
 
 
 Irssi::command_bind("pango", \&pango);
+
+$utf8= Irssi::settings_get_str('term_charset') eq 'UTF-8';
+
+# vim:set ts=4 sw=4 expandtab:
git clone https://git.99rst.org/PROJECT