Skip to content

Commit

Permalink
fix for numpy array creation error with non-utf8 strings
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed Apr 11, 2023
1 parent 8b567dc commit 490be2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions h5pyd/_apps/utillib.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def copy_attribute(desobj, name, srcobj, ctx):
if ctx["verbose"]:
print(msg)
data = data.decode("utf-8", errors="surrogateescape")
src_dt = None # let numpy figure out the unicode type

# First, make sure we have a NumPy array.
if is_h5py(srcobj):
Expand Down
3 changes: 2 additions & 1 deletion test/apps/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def get_test_filenames():
"d_link_hard.h5",
"d_link_soft.h5",
"scale_offset.h5",
"fletcher32.h5"
"fletcher32.h5",
"undecodable_attr.h5"
)

cfg = {
Expand Down

0 comments on commit 490be2b

Please sign in to comment.