Fix surrogate-related UnicodeEncodeError on CSV export

Fixes #210.
Merge branch 'master' into develop