343 if res != QMessageBox.Save: |
343 if res != QMessageBox.Save: |
344 return |
344 return |
345 fname = Utilities.toNativeSeparators(fname) |
345 fname = Utilities.toNativeSeparators(fname) |
346 |
346 |
347 try: |
347 try: |
348 f = open(fname, "w") |
348 f = open(fname, "w", encoding = "utf-8") |
349 f.write(self.contents.toPlainText()) |
349 f.write(self.contents.toPlainText()) |
350 f.close() |
350 f.close() |
351 except IOError as why: |
351 except IOError as why: |
352 QMessageBox.critical(self, self.trUtf8('Save Diff'), |
352 QMessageBox.critical(self, self.trUtf8('Save Diff'), |
353 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |
353 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |