added support for handling binary data values (no more garbish chars)

This commit is contained in:
Miroslav Stampar
2011-04-09 23:13:16 +00:00
parent 4ad73f9263
commit c714ac6421
3 changed files with 9 additions and 2 deletions

View File

@@ -2524,4 +2524,7 @@ def getSafeHexEncodedBinaryData(value):
retVal = value
if isinstance(value, basestring):
retVal = reduce(lambda x, y: x + (y if (y in string.printable or ord(y) > 255) else '\%x' % ord(y)), value, unicode())
elif isinstance(value, list):
for i in xrange(len(value)):
retVal[i] = getSafeHexEncodedBinaryData(value[i])
return retVal