From b8da548e63c850f57ba4aefc4951952c72047d36 Mon Sep 17 00:00:00 2001
From: Daniel Knuettel <Daniel Knuettel>
Date: Fri, 1 Mar 2024 13:39:23 +0100
Subject: [PATCH] fixed a bug in corr_io: UTF-8 tag encoding was broken

---
 lib/gpt/core/io/corr_io.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/gpt/core/io/corr_io.py b/lib/gpt/core/io/corr_io.py
index d20bf2e71..6fb0a4061 100644
--- a/lib/gpt/core/io/corr_io.py
+++ b/lib/gpt/core/io/corr_io.py
@@ -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)