305 if res != QMessageBox.Save: |
305 if res != QMessageBox.Save: |
306 return |
306 return |
307 fname = Utilities.toNativeSeparators(fname) |
307 fname = Utilities.toNativeSeparators(fname) |
308 |
308 |
309 try: |
309 try: |
310 f = open(fname, "w") |
310 f = open(fname, "w", encoding = "utf-8") |
311 f.write(self.contents.toPlainText()) |
311 f.write(self.contents.toPlainText()) |
312 f.close() |
312 f.close() |
313 except IOError as why: |
313 except IOError as why: |
314 QMessageBox.critical(self, self.trUtf8('Save Diff'), |
314 QMessageBox.critical(self, self.trUtf8('Save Diff'), |
315 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |
315 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |