added encoding to create_temporary_file