Skip to content

Commit

Permalink
fixed a bug in corr_io: UTF-8 tag encoding was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Knuettel authored and Daniel Knuettel committed Mar 1, 2024
1 parent e67ffeb commit b8da548
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/gpt/core/io/corr_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ def __init__(self, fn):

def write(self, t, cc):
if self.f is not None:
self.f.write(struct.pack("i", len(t) + 1))
self.f.write((t + "\0").encode("utf-8"))
tag_data = (t + "\0").encode("utf-8")
self.f.write(struct.pack("i", len(tag_data)))
self.f.write(tag_data)
ln = len(cc)
ccr = [fff for sublist in ((c.real, c.imag) for c in cc) for fff in sublist]
bindata = struct.pack("d" * 2 * ln, *ccr)
Expand Down

0 comments on commit b8da548

Please sign in to comment.