]> git.aero2k.de Git - sirius.git/commitdiff
Support unicode html
authorJoe Rickerby <joerick@mac.com>
Wed, 10 Jan 2018 19:10:43 +0000 (19:10 +0000)
committerJoe Rickerby <joerick@mac.com>
Wed, 10 Jan 2018 19:10:43 +0000 (19:10 +0000)
sirius/coding/default_template.html
sirius/coding/image_encoding.py

index 21247177e2c403d0c20e90ae502967b118869367..ef38bf382af73693e857fb711abd28615a83d088 100644 (file)
@@ -1,5 +1,7 @@
+<!DOCTYPE html>
 <html>
   <head>
+    <meta charset="utf-8">
     <style>
       html, body {
         margin: 0;
index 261df6c8f698ec11304fcbf0da4f5eb44e5feaac..a38e8ad247779b31b191314205b1ac0adedc9e16 100644 (file)
@@ -117,7 +117,10 @@ def html_to_png(html):
         # note that the .html suffix is required to make phantomjs
         # pick up the mime-type and render correctly.
         with tempfile.NamedTemporaryFile(suffix='.html') as f:
-            f.write(html)
+            if isinstance(html, unicode):
+                f.write(html.encode('utf8'))
+            else:
+                f.write(html)
             f.flush()
             driver.get('file://' + f.name)
             data = io.BytesIO(driver.get_screenshot_as_png())