From 632d5e02085ee53f5dbe1d4774382e89e3d89970 Mon Sep 17 00:00:00 2001
From: Ivan Clark <ivan.clark@ed.ac.uk>
Date: Fri, 5 Apr 2024 15:58:15 +0100
Subject: [PATCH] Change to swainlab_parser avoids an encoding error with some
 datasets that prevents parsing

---
 src/logfile_parser/swainlab_parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/logfile_parser/swainlab_parser.py b/src/logfile_parser/swainlab_parser.py
index f9d2a3b..d53779a 100644
--- a/src/logfile_parser/swainlab_parser.py
+++ b/src/logfile_parser/swainlab_parser.py
@@ -104,7 +104,7 @@ class HeaderEndNotFound(Exception):
 
 def extract_header(filepath: Path):
     """Extract content of log file before the experiment starts."""
-    with open(filepath, "r", errors="ignore") as f:
+    with (filepath, "r", errors="ignore", encoding = 'unicode_escape') as f:
         try:
             header = ""
             for _ in range(MAX_NLINES):
-- 
GitLab