[meld] filediff: Actually try to use UTF-8 on saving when we say we will
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Actually try to use UTF-8 on saving when we say we will
- Date: Wed, 31 Dec 2014 23:33:17 +0000 (UTC)
commit 2865d091ff9e4f7b0b70c8049588974eb32f63c7
Author: Kai Willadsen <kai willadsen gmail com>
Date: Mon Dec 29 09:16:24 2014 +1000
filediff: Actually try to use UTF-8 on saving when we say we will
meld/filediff.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index ee15840..1bcd73d 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1699,14 +1699,17 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
if k != '\n':
text = text.replace('\n', k)
break
- if bufdata.encoding:
+
+ while isinstance(text, unicode):
try:
text = text.encode(bufdata.encoding)
except UnicodeEncodeError:
if misc.run_dialog(
_("'%s' contains characters not encodable with '%s'\nWould you like to save as UTF-8?")
% (bufdata.label, bufdata.encoding),
self, Gtk.MessageType.ERROR, Gtk.ButtonsType.YES_NO) != Gtk.ResponseType.YES:
- return False
+ bufdata.encoding = 'utf-8'
+ continue
+ return False
save_to = bufdata.savefile or bufdata.filename
if self._save_text_to_filename(save_to, text):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]