krig / git-age

A git-blame viewer, written using PyGTK.
http://github.com/krig/git-age/wikis/home
GNU General Public License v3.0
35 stars 3 forks source link

buffer fails to be filled in win32 due to utf8 assertion #2

Open frogonwheels opened 14 years ago

frogonwheels commented 14 years ago

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

frogonwheels commented 14 years ago

Under win32, I get this warning message

c:\Apps\krig\gitageinit.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).

krig commented 14 years ago

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. :)