Archive for August, 2013

irssi, bitlbee, jabber, openfire and ASCII Control Characters

Wednesday, August 7th, 2013

I’ve recently been hit by an issue where irssi (and bitlbee, and openfire) have been leaking non-printable ASCII Control characters to a Jabber chat room.

This has been triggering an XML Parse Error in Pidgin clients, which causes them to disconnect and reconnect to the Jabber server. This is especially annoying when the server replays chat history to clients. You end up with all Pidgin clients unable to stay connected to your Jabber server. Oops.

I’ve written a quick hacky script for irssi that filters out non-ASCII characters, so they’re not sent to the server and that warns you that you’re doing somethig wrong:

use Irssi;
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "0.1";
%IRSSI = (
    authors     => 'Andy Millar',
    name        => 'filter_charset',
    description => 'Filter Outbount Charset',
    license     => 'none',
    url         => 'none',
Irssi::signal_add_first 'send text', 'filter_charset';
sub filter_charset {
  my ($text, $server, $win_item) = @_;
  if ($text =~ m/[^[:print:]]/) {
    Irssi::active_win->print("Cannot send line - invalid characters: ##$text##", MSGLEVEL_CLIENTCRAP);

Put this in ~/.irssi/scripts/ and then /load