From 441a064d843adf14e404797a78c101b4939d9e76 Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Wed, 24 Apr 2024 09:51:58 +0200
Subject: [PATCH] Solver: CommandLine: Try fix Windows encoding crash.

---
 src/Solver/CommandLine.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Solver/CommandLine.py b/src/Solver/CommandLine.py
index 4afcbc9a..5f706d1a 100644
--- a/src/Solver/CommandLine.py
+++ b/src/Solver/CommandLine.py
@@ -167,8 +167,10 @@ class CommandLineSolver(AbstractSolver):
             repertory, "pamhyr-study-description.txt"
         )
 
-        with open(path, "w+") as f:
-            txt = study.description
+        with open(path, "w+", encoding='utf-8') as f:
+            txt = study.description\
+                       .encode()\
+                       .decode('utf-8', 'replace')
             f.write(txt)
 
     #######
-- 
GitLab