When trying to log a statements like this during logging:
In : logstart -o logtest.py over
In : t = 'žćčšđ'
UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-9: ordinal not in range(128)
The supplied patch fixes the problem. At least temporary.
Also, changed the log header to contain the encoding definition for the source file.
Useful for rerunning the log file outside IPython.
Encode data with system default encoding before writing to log file.
This enables writing non-ascii characters to be written in log file during
Defining system default encoding in log file header comment.
Looking at the code, output data is written separately. It's not easy to get unicode output in Python 2.x (assuming we're limited to reprs produced by the interpreter, not print statements), but it is possible: define a class, replace its __name__ with a unicode character, and ask for it. So we should probably encode odata too, just to be on the safe side.
Adding encoding also to output and merging for 0.10.2 release. Many thanks!