Skip to content

Commit eedb732

Browse files
committed
make utf8 default reading format
1 parent 8b3c29f commit eedb732

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pyedflib/edfreader.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,13 @@ def _get_float(self, v: np.ndarray) -> np.ndarray:
167167
return result
168168

169169
def _convert_string(self, s: Union[bytes, str]) -> str:
170+
"""decode a byte to string using utf8"""
170171
if isinstance(s, bytes):
171-
return s.decode("latin")
172+
return s.decode()
172173
elif isinstance(s, str):
173174
return s
174175
else:
175-
return s.decode("utf_8", "strict") # type: ignore
176+
raise TypeError('unknown string type: {type(s)=}')
176177

177178
def getHeader(self) -> Dict[str, Union[str, datetime]]:
178179
"""

0 commit comments

Comments
 (0)