[meld: 2/63] filediff: Use the GtkSourceEncoding instead of the charset name
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld: 2/63] filediff: Use the GtkSourceEncoding instead of the charset name
- Date: Wed, 16 Dec 2015 21:19:07 +0000 (UTC)
commit d97267329e86503d304ecc97c965e605fd4999ff
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Jul 18 14:35:47 2015 +1000
filediff: Use the GtkSourceEncoding instead of the charset name
meld/filediff.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 3b4a2fc..c34d8c4 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1120,8 +1120,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
write_file = Gio.File.new_for_path(buf.data.savefile) if buf.data.savefile else gfile
self.set_buffer_writable(buf, is_writable(write_file))
- # TODO: Move to using the GtkSourceEncoding type
- buf.data.encoding = loader.get_encoding().get_charset()
+ buf.data.encoding = loader.get_encoding()
# TODO: Remove handling for mixed newlines in other places, or add
# mixed newline support to GtkSourceFile.
@@ -1569,9 +1568,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
# text = text.replace('\n', k)
# break
- encoding = bufdata.encoding
+ source_encoding = bufdata.encoding
while isinstance(text, unicode):
try:
+ encoding = source_encoding.get_charset()
text = text.encode(encoding)
except UnicodeEncodeError:
dialog_buttons = [
@@ -1591,7 +1591,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
if reencode != Gtk.ResponseType.OK:
return False
- encoding = 'utf-8'
+ source_encoding = GtkSource.Encoding.get_utf8()
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]