Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
You will get better answers on a development site. This site is more from a users perspective. – coteyr Nov 29 '12 at 20:00

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.