1
0
forked from IPKM/nmreval

Add encoding to read/write

This commit is contained in:
2025-10-10 13:24:43 +00:00
parent 8710d9b831
commit 2f2e854d07

View File

@@ -120,7 +120,7 @@ class GraceEditor:
# we start always with the header # we start always with the header
current_pos = 'header' current_pos = 'header'
with self.file.open('r', errors='replace') as f: with self.file.open('r', errors='replace', encoding='iso-8859-15') as f:
for line_nr, line in enumerate(f): for line_nr, line in enumerate(f):
# lots of states to check # lots of states to check
# agr file order: header, drawing object, region, graph, set # agr file order: header, drawing object, region, graph, set
@@ -331,7 +331,7 @@ class GraceEditor:
def write(self, fname): def write(self, fname):
outfile = pathlib.Path(fname) outfile = pathlib.Path(fname)
with outfile.open('w') as f: with outfile.open('w', encoding='iso-8859-15') as f:
f.write(str(self.header)) f.write(str(self.header))
f.flush() f.flush()