Module: check_mk
Branch: master
Commit: 0985d7fe14a25558d9b30220e74d024d856f85f5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0985d7fe14a255…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Apr 14 17:04:04 2014 +0200
FIX Fix exception on non-UTF-8 encoded characters in software list
---
.werks/886 | 9 +++++++++
ChangeLog | 3 +++
web/plugins/views/inventory.py | 8 ++++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/.werks/886 b/.werks/886
new file mode 100644
index 0000000..77c3c46
--- /dev/null
+++ b/.werks/886
@@ -0,0 +1,9 @@
+Title: Fix exception on non-UTF-8 encoded characters in software list
+Level: 2
+Component: inv
+Class: fix
+State: unknown
+Version: 1.2.5i3
+Date: 1397487819
+
+
diff --git a/ChangeLog b/ChangeLog
index c6573f3..a538050 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -64,6 +64,9 @@
Livestatus:
* 0747 FIX: livestatus table hostsbygroup: fixed bug with group_authorization
strict...
+ inv:
+ * 0886 FIX: Fix exception on non-UTF-8 encoded characters in software list
+
1.2.5i2:
Checks & Agents:
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 290ef2c..48c65e9 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -374,9 +374,13 @@ def render_inv_subtree_leaf(hostname, invpath, node):
elif "render" in hint:
hint["render"](node)
elif type(node) == str:
- html.write(node.decode("utf-8"))
+ try:
+ text = node.decode("utf-8")
+ except:
+ text = node
+ html.write(html.attrencode(node))
elif type(node) == unicode:
- html.write(node)
+ html.write(html.attrencode(node))
elif type(node) == int:
html.write(str(node))
elif type(node) == float: