return unless &logged_in($twit);
my ( $fh, $filename ) = File::Temp::tempfile();
- binmode( $fh, ":utf8" );
+ binmode( $fh, ":" . &get_charset );
$child_pid = fork();
if ($child_pid) { # parent
}
$id_map{__searches}{$username}{$topic} = $search->{max_id};
- $topic =~ s/ /\\ /g;
+ $topic =~ s/ /%20/g;
printf $fh "id:%s account:%s type:searchid topic:%s\n",
$search->{max_id}, $username, $topic;
# pretend
if ( open FILE, $filename ) {
- binmode FILE, ":utf8";
+ binmode FILE, ":" . &get_charset;
my @lines;
my %new_cache;
while (<FILE>) {
foreach my $key (qw/id account nick type topic/) {
if (s/^$key:((?:\S|\\ )+)\s*//) {
$meta{$key} = $1;
- $meta{$key} =~ s/\\ / /g;
+ $meta{$key} =~ s/%20/ /g;
}
}
return 60;
}
+sub get_charset {
+ my $charset = Irssi::settings_get_str("twirssi_charset");
+ return "utf8" if $charset =~ /^\s*$/;
+ return $charset;
+}
+
sub hilight {
my $text = shift;
"Set short_url_args to username,API_key or change your",
"short_url_provider."
);
- return decode "utf8", $data;
+ return decode &get_charset, $data;
}
}
}
}
- return decode "utf8", $data;
+ return decode &get_charset, $data;
}
sub normalize_username {
);
Irssi::settings_add_int( "twirssi", "twitter_poll_interval", 300 );
+Irssi::settings_add_str( "twirssi", "twirssi_charset", "utf8" );
Irssi::settings_add_str( "twirssi", "twitter_window", "twitter" );
Irssi::settings_add_str( "twirssi", "bitlbee_server", "bitlbee" );
Irssi::settings_add_str( "twirssi", "short_url_provider", "TinyURL" );