Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codepage #1

Closed
StreamThreader opened this issue Apr 25, 2017 · 1 comment
Closed

Codepage #1

StreamThreader opened this issue Apr 25, 2017 · 1 comment

Comments

@StreamThreader
Copy link

HI, please help.
In nagios i use Cyrillic text for some fields (for example host description).
Nagibot works fine, but Cyrillic text it send in unknown encoding.
I trying use iconv but can not find right codepage.
Nagios (printf) send text to fifo pipe as UTF-8, but client view
"��новной �е�минал�н�й �е�ве�"
instead normal
"Основной терминальній сервер"
How i can tune message encoding ?

@StreamThreader
Copy link
Author

StreamThreader commented May 3, 2017

I found how resolve this
Attached patch file:
nagibot use decode utf8.patch.zip

`--- nagibot.pl--- 2017-05-03 12:14:43.202990000 +0300
+++ nagibot.pl 2017-05-03 12:27:04.109764000 +0300
@@ -38,6 +38,7 @@
use POSIX qw(setsid);
use File::Pid;
use HTML::Entities;
+use Encode;

use vars qw($event $timer_event $io_event $connection $disco $muc $terminating);

@@ -295,15 +296,15 @@
# TODO: Implement rejoin
return;
}

  •        my $msg =  $r->make_message (body => $input);
    
  •        &HtmlifyMsg($msg, $input) if $config->{'htmlify_msg'};
    
  •        my $msg =  $r->make_message (body => Encode::decode( 'UTF-8', $input ));
    
  •        &HtmlifyMsg($msg, Encode::decode( 'UTF-8', $input )) if $config->{'htmlify_msg'};
           $msg->send ();
       }
    
       # send message to all users
       foreach my $ujid (@$jids) {
    
  •        my $msg =  AnyEvent::XMPP::IM::Message->new (to => $ujid, body => $input, type => 'chat');
    
  •        &HtmlifyMsg($msg, $input) if $config->{'htmlify_msg'};
    
  •        my $msg =  AnyEvent::XMPP::IM::Message->new (to => $ujid, body => Encode::decode( 'UTF-8', $input ), type => 'chat');
    
  •        &HtmlifyMsg($msg, Encode::decode( 'UTF-8', $input )) if $config->{'htmlify_msg'};
           $msg->send ($connection);
       }
    

`

Nothing4You pushed a commit to Nothing4You/NagiBot that referenced this issue Nov 21, 2018
This applies the patch from ajobs#1
Thanks to @StreamThreader
@ajobs ajobs closed this as completed in 17fb5a5 Dec 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant