diff --git a/junit2htmlreport/matrix.py b/junit2htmlreport/matrix.py
index <HASH>..<HASH> 100644
--- a/junit2htmlreport/matrix.py
+++ b/junit2htmlreport/matrix.py
@@ -137,8 +137,8 @@ class HtmlReportMatrix(ReportMatrix):
         if self.outdir != "" and not os.path.exists(self.outdir):
             os.makedirs(self.outdir)
         with open(
-                os.path.join(self.outdir, basename) + ".html", "w") as filehandle:
-            filehandle.write(report)
+                os.path.join(self.outdir, basename) + ".html", "wb") as filehandle:
+            filehandle.write(report.encode("utf-8"))
 
     def short_outcome(self, outcome):
         if outcome == PASSED:
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ files = [os.path.join("templates", "*.css"),
 
 setup(
     name="junit2html",
-    version="30.0.4",
+    version="30.0.5",
     description="Generate HTML reports from Junit results",
     author="Ian Norton",
     author_email="inorton@gmail.com",
Write HTML in unicode and bumpt to <I>