os.write wants bytes, not str.

Plugin retrieves the content of the document as a string, and tries to write it in a file.  But os.write refuses to do magical conversion to bytes. It is necessary to get document encoding (got here as a GeditEncoding) and pass it as a python code (as in http://docs.python.org/3.3/library/codecs.html#standard-encodings). 

The PR is imperfect (works at least for utf8) as I don't know how to automatically convert GeditEncoding to python codecs.