Skip to content

Commit

Permalink
Encode strings as utf-8 when writing to binary file. Fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmatthews committed Sep 18, 2014
1 parent ed5d0d7 commit 97004bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions COT/ovf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,8 @@ def generate_manifest(self, ovf_file):
return False
with open(manifest, 'wb') as f:
f.write("SHA1({file})= {sum}\n"
.format(file=os.path.basename(ovf_file), sum=sha1sum))
.format(file=os.path.basename(ovf_file), sum=sha1sum)
.encode('utf-8'))
# Checksum all referenced files as well
for file in self.find_all_children(self.references, self.FILE):
file_name = file.get(self.FILE_HREF)
Expand All @@ -1542,7 +1543,8 @@ def generate_manifest(self, ovf_file):
continue
sha1sum = get_checksum(file_path, 'sha1')
f.write("SHA1({file})= {sum}\n"
.format(file=file_name, sum=sha1sum))
.format(file=file_name, sum=sha1sum)
.encode('utf-8'))
logger.debug("Manifest generated successfully")
return True

Expand Down

0 comments on commit 97004bb

Please sign in to comment.