git-age icon indicating copy to clipboard operation
git-age copied to clipboard

buffer fails to be filled in win32 due to utf8 assertion

Open frogonwheels opened this issue 16 years ago • 2 comments

A utf8-validate assertion happens, and the buffer fails to be loaded.

frogonwheels avatar Feb 12 '10 03:02 frogonwheels

Under win32, I get this warning message

c:\Apps\krig\gitage__init__.py:256: GtkWarning: gtk_text_buffer_emit_insert: as sertion `g_utf8_validate (text, len, NULL)' failed

The very simplistic modification of Changing the set_text line to: self.sourcebuffer.set_text(unicode(self.blamed.text,"iso-8859-1")) seems to work under windows for standard files.

I have no real knowledge of python, so choosing the encoding in a more robust way would be an advantage (checking the bom marker - used a lot in windows - would allow distinguishing between utf8, ucs2-le ucs2-be encodings). I'm thinking that a filesystem dependent default would be appropriate (iso-8859-1 or get the system encoding somehow for windows, utf8 otherwise).

frogonwheels avatar Feb 12 '10 03:02 frogonwheels

Hey, I committed a new version which simply does what you suggested on windows. Unfortunately I don't have a windows machine handy to test on, so I don't know if it actually works. :)

krig avatar Mar 13 '10 23:03 krig