[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Gerhard Lausser
gerhard.lausser at consol.de
Tue Feb 28 22:08:16 UTC 2012
The following commit has been merged in the debian/master branch:
commit f0497391e013f5a1d55a6c1d64b82cb0722dfa95
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date: Thu Dec 8 23:08:35 2011 +0100
better encoding of umlauts in livestatus output
diff --git a/shinken/modules/livestatus_broker/livestatus_response.py b/shinken/modules/livestatus_broker/livestatus_response.py
index 2340bb3..f274a58 100644
--- a/shinken/modules/livestatus_broker/livestatus_response.py
+++ b/shinken/modules/livestatus_broker/livestatus_response.py
@@ -68,6 +68,8 @@ class LiveStatusResponse:
showheader = False
#print "my result is", result
print "outputformat", self.outputformat
+ stdout_encoding = sys.getdefaultencoding()
+ #stdout_encoding = "UTF-8"
if self.outputformat == 'csv':
if len(columns) == 0:
# There is no pre-selected list of columns. In this case
@@ -78,6 +80,8 @@ class LiveStatusResponse:
for x in [object[c] for c in sorted(object.keys())]:
if isinstance(x, list):
l.append(self.separators[2].join(str(y) for y in x))
+ elif isinstance(x, basestring):
+ l.append(x.encode(stdout_encoding, 'replace'))
else:
l.append(str(x))
lines.append(self.separators[1].join(l))
@@ -88,6 +92,8 @@ class LiveStatusResponse:
for x in [object[c] for c in columns]:
if isinstance(x, list):
l.append(self.separators[2].join(str(y) for y in x))
+ elif isinstance(x, basestring):
+ l.append(x.encode(stdout_encoding, 'replace'))
else:
l.append(str(x))
lines.append(self.separators[1].join(l))
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list