mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
use utf8 encoding for file operations (#180)
This commit is contained in:
@@ -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}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user