Modified writing to CSV to first encode to UTF-8