Use the python codecs module to write generated files using utf-8 encoding.