Commit a6ed5ccc authored by Kai Willadsen's avatar Kai Willadsen

filediff, meldbuffer: Get the encodings from the source file

parent 2f2184fd
......@@ -1074,13 +1074,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
'dialog-error-symbolic', primary, err.message)
buf = loader.get_buffer()
if success:
buf.data.encoding = loader.get_encoding()
start, end = buf.get_bounds()
buffer_text = buf.get_text(start, end, False)
if not buf.data.encoding and '\\00' in buffer_text:
if not loader.get_encoding() and '\\00' in buffer_text:
primary = _("File %s appears to be a binary file.") % filename
secondary = _(
"Do you want to open the file using the default application?")
......@@ -1482,7 +1478,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
start, end = buf.get_bounds()
text = text_type(buf.get_text(start, end, False), 'utf8')
source_encoding = bufdata.encoding
source_encoding = bufdata.sourcefile.get_encoding()
while isinstance(text, unicode):
try:
encoding = source_encoding.get_charset()
......
......@@ -117,7 +117,6 @@ class MeldBufferData(GObject.GObject):
self.label = self._label if same_file else self.filename
self.loaded = False
self.savefile = None
self.encoding = None
def __del__(self):
self._disconnect_monitor()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment