Skip to content

Commit b7de364

Browse files
committed
force UTF8 encoding for output files
1 parent f048adb commit b7de364

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

wxmplot/imageconf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def save_config(self, evt=None, fname='wxmplot.yaml'):
401401
if dlg.ShowModal() == wx.ID_OK:
402402
conf = self.conf.get_current_config()
403403
ppath = os.path.abspath(dlg.GetPath())
404-
with open(ppath, 'w') as fh:
404+
with open(ppath, 'w', encoding='utf-8') as fh:
405405
fh.write("%s\n" % yaml.dump(conf))
406406

407407

wxmplot/imageframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,6 @@ def ExportTextFile(self, fname, title='unknown map'):
939939
darr.extend(data[iy, ix])
940940
buff.append(" ".join([gformat(arr, 12) for arr in darr]))
941941
buff.append("")
942-
with open(fname, 'w') as fout:
942+
with open(fname, 'w', encoding='utf-8') as fout:
943943
fout.write("\n".join(buff))
944944
fout.close()

wxmplot/imagematrixframe.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,5 @@ def ExportTextFile(self, fname, title='unknown map'):
566566
d = [ydat[iy], xdat[ix], self.map1[iy, ix], self.map2[iy, ix]]
567567
buff.append(" ".join([gformat(a, 12) for a in d]))
568568

569-
fout = open(fname, 'w')
570-
fout.write("%s\n" % "\n".join(buff))
571-
fout.close()
569+
with open(fname, 'w', encoding='utf-8') as fout:
570+
fout.write("%s\n" % "\n".join(buff))

wxmplot/plotconfigframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def save_config(self, evt=None, fname='wxmplot.yaml'):
139139
if dlg.ShowModal() == wx.ID_OK:
140140
conf = self.conf.get_current_config()
141141
ppath = os.path.abspath(dlg.GetPath())
142-
with open(ppath, 'w') as fh:
142+
with open(ppath, 'w', encoding='utf-8') as fh:
143143
fh.write("%s\n" % yaml.dump(conf))
144144

145145

wxmplot/plotframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def ExportTextFile(self, fname, title='unknown plot'):
114114
buff.append(' '.join(oline))
115115

116116
buff.append('')
117-
with open(fname, 'w') as fout:
117+
with open(fname, 'w', encoding='utf-8') as fout:
118118
fout.write("\n".join(buff))
119119
fout.close()
120120
self.write_message("Exported data to '%s'" % fname, panel=0)

wxmplot/stackedplotframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def ExportTextFile(self, fname, title='uknown plot'):
9595
buff.append(' '.join(oline))
9696

9797
buff.append('')
98-
with open(fname, 'w') as fout:
98+
with open(fname, 'w', encoding='utf-8') as fout:
9999
fout.write("\n".join(buff))
100100
fout.close()
101101
self.write_message("Exported data to '%s'" % fname, panel=0)

0 commit comments

Comments
 (0)