From 983092c1828541d61f7bc5f3ab7f598ed6cd15c2 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Tue, 26 Mar 2024 08:44:16 -0400 Subject: [PATCH] use utf8 encoding for file operations (#180) --- opendevin/action/fileop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opendevin/action/fileop.py b/opendevin/action/fileop.py index 77accb8e77..fcf45cfce3 100644 --- a/opendevin/action/fileop.py +++ b/opendevin/action/fileop.py @@ -21,7 +21,7 @@ class FileReadAction(ExecutableAction): def run(self, *args, **kwargs) -> Observation: path = resolve_path(self.base_path, self.path) - with open(path, 'r') as file: + with open(path, 'r', encoding='utf-8') as file: return Observation(file.read()) @property @@ -37,7 +37,7 @@ class FileWriteAction(ExecutableAction): def run(self, *args, **kwargs) -> Observation: path = resolve_path(self.base_path, self.path) - with open(path, 'w') as file: + with open(path, 'w', encoding='utf-8') as file: file.write(self.contents) return Observation(f"File written to {path}")