baverman/snaked

could not open session

Closed this issue · 5 comments

xcat commented

Hello gays!
I try to use snaked. I strong vim user, but trying...

I was open file with error encoding(cp1251)

File "/usr/local/lib/python2.6/dist-packages/snaked-0.3.5-py2.6.egg/snaked/util/init.py", line 13, in idle_callback
callable(_args, *_kwargs)
File "/usr/local/lib/python2.6/dist-packages/snaked-0.3.5-py2.6.egg/snaked/core/editor.py", line 71, in load_file
self.buffer.set_text(open(filename).read().decode('utf-8'))
File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc4 in position 202: invalid continuation byte

Editor was blocked, and I kill him.
But session was stored with that errorfile. And I couldn't restore my session.

Where is stored session info?

Sorry for such inconvenience, but snaked currently support only utf-8 encoding. I didn't found good solution for encoding selection. Seems I'll do auto choose similar to gedit's.

Sessions stored in ~/.config/snaked/*.session files for snaked >= 0.3.7

jafd commented

Something like reading a file as a bag of bytes, using chardet to detect charset and then decoding with appropriate codec would do the job, I suppose. Or a pull-down list, and handling the exception, of course...

Fixed.

xcat commented

Verified %)

If you will have any problems with automatic encoding detection I'll make appropriate per file manual option to set.