how to save a gtktextbuffer content in file
- by user1565593
i tried to save sengtktextbuffer content in a file. my code seens working but i have a problem in file.
some characters are unreadable in outfile
outfile
my code:
def on_save_clicked(self, widget, data=None):
start = self.textbuffer.get_start_iter()
end = self.textbuffer.get_end_iter()
this = self.textbuffer.get_text(start, end, False)
format = self.textbuffer.register_serialize_tagset(this)
data = self.textbuffer.serialize(self.textbuffer, format, start, end)
outfile = open("/home/christophe/toto.txt", "w")
outfile.write(data)
outfile.close()
what is wrong in my code?
thanks for your help