Handle Py2/3 Unicode differences when writing to stdout

Closes #94.