Skip to content

Commit

Permalink
fixes #175. utf-8 errors in Python 3 (#208)
Browse files Browse the repository at this point in the history
Caused by block reads chopping multibyte utf-8 sequences in half.
  • Loading branch information
mcarlsen authored and chattarajoy committed May 14, 2019
1 parent 62468d2 commit 756d517
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qds_sdk/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,9 @@ def _read_iteratively(key_instance, fp, delim):
else:
import io
if isinstance(fp, io.TextIOBase):
fp.buffer.write(data.decode('utf-8').replace(chr(1), delim).encode('utf8'))
fp.buffer.write(data.replace(bytes([1]), delim.encode('utf8')))
elif isinstance(fp, io.BufferedIOBase) or isinstance(fp, io.RawIOBase):
fp.write(data.decode('utf8').replace(chr(1), delim).encode('utf8'))
fp.write(data.replace(bytes([1]), delim.encode('utf8')))
else:
# Can this happen? Don't know what's the right thing to do in this case.
pass
Expand Down

0 comments on commit 756d517

Please sign in to comment.