aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-09-12 17:36:00 +0100
committerMichael Williamson <mike@zwobble.org>2015-09-12 17:36:00 +0100
commitb1ff76175f8b56a20155f831d601b0f891a7755b (patch)
tree4acb1af1b2bd8e6b49086b720aed0748ad402f93
parentaeb69f46af4f59bca08c38117c41ce1d5dc82e06 (diff)
Handle string encoding in style maps properly
-rw-r--r--mammoth/docx/style_map.py2
-rw-r--r--mammoth/zips.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/mammoth/docx/style_map.py b/mammoth/docx/style_map.py
index 9d2646a..bf851e9 100644
--- a/mammoth/docx/style_map.py
+++ b/mammoth/docx/style_map.py
@@ -15,7 +15,7 @@ def write_style_map(fileobj, style_map):
content_types_xml = _generate_content_types_xml(zip_file.read_str(_content_types_path))
update_zip(fileobj, {
- _style_map_path: style_map,
+ _style_map_path: style_map.encode("utf8"),
_relationships_path: relationships_xml,
_content_types_path: content_types_xml,
})
diff --git a/mammoth/zips.py b/mammoth/zips.py
index 4d77acb..432be5d 100644
--- a/mammoth/zips.py
+++ b/mammoth/zips.py
@@ -42,7 +42,7 @@ def update_zip(fileobj, files):
names = set(source.namelist()) | set(files.keys())
for name in names:
if name in files:
- contents = files[name].encode("utf8")
+ contents = files[name]
else:
contents = source.read(name)
destination.writestr(name, contents)