Dumper: Fix missing import

Additonally ensure that code path works with Python 2.7+ and 3+.

Change-Id: I6c7895eeb830259dc07bb7f64049ae51cb814c7f
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2017-03-16 15:37:44 +01:00
parent a8f64bd1b9
commit 8204d794e2

View File

@@ -24,6 +24,7 @@
############################################################################ ############################################################################
import os import os
import codecs
import copy import copy
import collections import collections
import struct import struct
@@ -436,7 +437,7 @@ class DumperBase:
elif self.currentValue.encoding == 'utf8': elif self.currentValue.encoding == 'utf8':
value = self.hexdecode(value) value = self.hexdecode(value)
elif self.currentValue.encoding == 'utf16': elif self.currentValue.encoding == 'utf16':
b = bytes.fromhex(value) b = bytes(bytearray.fromhex(value))
value = codecs.decode(b, 'utf-16') value = codecs.decode(b, 'utf-16')
self.put('"%s"' % value) self.put('"%s"' % value)
if self.currentValue.elided: if self.currentValue.elided: