First, I don't know Python at all, so my changes may not be completely correct but they works for me.
The patch changes two things:
1) it uses correct encoding when writing to mbox (the encoding is obtained using simple regexp matching charset in email).
2) string errors are ignored
Without these changes I was not able to backup my email archive where some emails contained non-ascii characters.
2nd version
Submitted second version. The regexp matching charset has been changed to work even when the value is not enclosed in quoted (eg. firebird seems to do this).
It would be nice to check whether matched encoding is supported by python.