Implement executing RecodeInstruction

This commit is contained in:
Jakob Moser 2025-06-01 16:26:31 +02:00
parent fa3df3d2e2
commit 4c6ef77a27
Signed by: jakob
GPG Key ID: 3EF2BA2851B3F53C

View File

@ -15,4 +15,8 @@ class RecodeInstruction(Instruction):
new_encoding: str
def __call__(self) -> None:
raise NotImplementedError()
with self.path.open("r", encoding=self.old_encoding) as f:
file_contents = f.read()
with self.path.open("w", encoding=self.new_encoding) as f:
f.write(file_contents)