Skip to content

Commit

Permalink
- irssi-utf0: simple irssi script to turn incoming utf8 into outgoing…
Browse files Browse the repository at this point in the history
… utf0

- handy for talking to people without properly configured irssi+putty+etc.
- TODO: fix minor bug which leads to irssi complaining about blank lines
  • Loading branch information
rjp committed Apr 20, 2010
1 parent 846a2df commit b865113
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions irssi-utf0/encoder.pl
@@ -0,0 +1,30 @@
use Irssi;
use Irssi::Irc;
use Encode qw(from_to encode decode);
use Data::Dumper;
use Text::Unidecode;

my ($noutf8win);

BEGIN {
# would be better to set a flag or something
$noutf8win = Irssi::window_find_name('noutf8');
if (!$noutf8win) {
Irssi::command("window new hide");
Irssi::command("window name noutf8");
$noutf8win = Irssi::window_find_name('noutf8');
}
}

sub event_send_text {
my ($line, $server, $window) = @_;
if ($window->{'name'} eq 'noutf8') { # avoid UTF8 here
$pastewin->print($line);
my $inter = decode('utf8', $line);
my $newline = unidecode($inter);
$window->command("msg ".$window->{name}." $newline");
Irssi::signal_stop();
}
}

Irssi::signal_add_first("send text", "event_send_text");

0 comments on commit b865113

Please sign in to comment.