Skip to content

Commit 09013d7

Browse files
committed
fix: replace unicode errors
1 parent 39988df commit 09013d7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

nbtlib/tag.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@
8282
]
8383

8484

85-
from struct import Struct, error as StructError
85+
from struct import Struct
86+
from struct import error as StructError
87+
8688
import numpy as np
8789

8890
from .literal.serializer import serialize_tag
8991

90-
9192
# Struct formats used to pack and unpack numeric values
9293

9394

@@ -216,7 +217,7 @@ def write_numeric(fmt, value, fileobj, byteorder="big"):
216217
def read_string(fileobj, byteorder="big"):
217218
"""Read a string from a file-like object."""
218219
length = read_numeric(USHORT, fileobj, byteorder)
219-
return fileobj.read(length).decode("utf-8")
220+
return fileobj.read(length).decode("utf-8", "replace")
220221

221222

222223
def write_string(value, fileobj, byteorder="big"):

0 commit comments

Comments
 (0)