From 14f88db872953e822f74e7e168abb2002b6d5566 Mon Sep 17 00:00:00 2001 From: Jacopo Taurino Date: Sat, 5 Oct 2024 17:41:08 +0200 Subject: [PATCH] Fix UnicodeEncodeError by ensuring UTF-8 encoding for file writes --- src/grasp_backend/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grasp_backend/__main__.py b/src/grasp_backend/__main__.py index fcff171..36ada7b 100644 --- a/src/grasp_backend/__main__.py +++ b/src/grasp_backend/__main__.py @@ -31,7 +31,7 @@ def append_org( # https://stackoverflow.com/a/13232181 if len(org.encode('utf8')) > 4096: logger.warning("writing out %s might be non-atomic", org) - with path.open('a') as fo: + with path.open('a', encoding='utf-8') as fo: # Added 'encoding='utf-8'' fo.write(org)