You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that when I send an external command that contains non ascii characters, it's not taken into account. I tested this with Thruk and Nagvis with French accents.
The external tools do send a proper UTF-8 encoded string (verified with Firebug for the http part and tcpdump for the livestatus tcp socket). The broker receives the external command, but it's never transmitted to the scheduler.
Here is the reason why:
The string is received as a Python byte string. Then it's decoded to a proper Python unicode string. The representation of this object contains escaped Unicode characters and some are mapped to the latin1 character set. When Shinken tries to send this Unicode string, it serializes it with Pickle, then convert the output to JSON with json.dumps. The JSON dumps function expects UTF-8 input, but it finds latin1 in the Pickle dump and throws a UnicodeDecodeError exception. The external never reaches it's destination.
Here is how to reproduce this behavior in the Python interpreter:
Drop the bytestring to unicode conversion. This solution affects the Livestatus module itself. To do this we should delete this line.
Ensure that the data are 7 bits safe. This solution affects Shinken's core. We should use for external commands what's done in other parts: cPickle, then zlib compression, then base64 encoding.
For information, the named-pipe module doesn't decode incoming data to unicode so it works, but the webui module does, so it has the same problem.
JCC
The text was updated successfully, but these errors were encountered:
Hello
I found that when I send an external command that contains non ascii characters, it's not taken into account. I tested this with Thruk and Nagvis with French accents.
The external tools do send a proper UTF-8 encoded string (verified with Firebug for the http part and tcpdump for the livestatus tcp socket). The broker receives the external command, but it's never transmitted to the scheduler.
Here is the reason why:
The string is received as a Python byte string. Then it's decoded to a proper Python unicode string. The representation of this object contains escaped Unicode characters and some are mapped to the latin1 character set. When Shinken tries to send this Unicode string, it serializes it with Pickle, then convert the output to JSON with json.dumps. The JSON dumps function expects UTF-8 input, but it finds latin1 in the Pickle dump and throws a UnicodeDecodeError exception. The external never reaches it's destination.
Here is how to reproduce this behavior in the Python interpreter:
We have two solutions to this problem:
For information, the named-pipe module doesn't decode incoming data to unicode so it works, but the webui module does, so it has the same problem.
JCC
The text was updated successfully, but these errors were encountered: