Skip to content

Commit

Permalink
use utf8 encoding for file operations (All-Hands-AI#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren committed Mar 26, 2024
1 parent 0758db2 commit 983092c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions opendevin/action/fileop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}")

Expand Down

0 comments on commit 983092c

Please sign in to comment.