gedit-source-code-browser icon indicating copy to clipboard operation
gedit-source-code-browser copied to clipboard

os.write wants bytes, not str.

Open FabricioS opened this issue 11 years ago • 1 comments

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.

FabricioS avatar Oct 30 '13 12:10 FabricioS

See https://git.gnome.org/browse/gedit/tree/gedit/gedit-encodings.c for the enumeration of GeditEncoding

FabricioS avatar Oct 30 '13 12:10 FabricioS