Skip to content

Commit 8874404

Browse files
committed
Changed splunklib/data.py load function to convert string utf-8 encoded only for utf strings, so that Python XML parser will not throw errors when processing utf-8 encoded responses.
1 parent 5a0c84a commit 8874404

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

splunklib/data.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ def load(text, match=None):
7676
'namespaces': [],
7777
'names': {}
7878
}
79-
root = XML(text.encode('utf-8'))
79+
80+
if isinstance(text, unicode):
81+
text = text.encode('utf-8')
82+
83+
root = XML(text)
8084
items = [root] if match is None else root.findall(match)
8185
count = len(items)
8286
if count == 0:

0 commit comments

Comments
 (0)