diff options
author | Picca Frédéric-Emmanuel <picca@debian.org> | 2021-01-06 14:10:12 +0100 |
---|---|---|
committer | Picca Frédéric-Emmanuel <picca@debian.org> | 2021-01-06 14:10:12 +0100 |
commit | b3bea947efa55d2c0f198b6c6795b3177be27f45 (patch) | |
tree | 4116758aafe4483bf472c1d54b519e685737fd77 /silx/gui/data/TextFormatter.py | |
parent | 5ad425ff4e62f5e003178813ebd073577679a00e (diff) |
New upstream version 0.14.0+dfsg
Diffstat (limited to 'silx/gui/data/TextFormatter.py')
-rw-r--r-- | silx/gui/data/TextFormatter.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/silx/gui/data/TextFormatter.py b/silx/gui/data/TextFormatter.py index 98c37d7..8fd7c7c 100644 --- a/silx/gui/data/TextFormatter.py +++ b/silx/gui/data/TextFormatter.py @@ -267,6 +267,12 @@ class TextFormatter(qt.QObject): if vlen is not None: if vlen == six.text_type: # HDF5 UTF8 + # With h5py>=3 reading dataset returns bytes + if isinstance(data, (bytes, numpy.bytes_)): + try: + data = data.decode("utf-8") + except UnicodeDecodeError: + self.__formatSafeAscii(data) return self.__formatText(data) elif vlen == six.binary_type: # HDF5 ASCII @@ -289,7 +295,7 @@ class TextFormatter(qt.QObject): elif isinstance(data, list): text = [self.toString(d) for d in data] return "[" + " ".join(text) + "]" - elif isinstance(data, (numpy.ndarray)): + elif isinstance(data, numpy.ndarray): if dtype is None: dtype = data.dtype if data.shape == (): |