Work around unicode errors in Python 2 (ST2) when logging

Needs more testing before merging. Also I grabbed common, which had some fixes from Emacs-land.