Fix unicode decode error on write()
unit test for unicode-error
replace str to text_type & pep8
typo
Merge branch 'fix-unicode-error' into 0.1-maintenance