changeset 1929:b603a3d516d3

jp (blog/edit): use utf-8-sig to decode content file to avoid BOM being propaged to content
author Goffi <goffi@goffi.org>
date Fri, 25 Mar 2016 15:32:43 +0100
parents 6a8b26754f0d
children 70ce9421c4d3
files frontends/src/jp/cmd_blog.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/jp/cmd_blog.py	Fri Mar 25 14:37:49 2016 +0100
+++ b/frontends/src/jp/cmd_blog.py	Fri Mar 25 15:32:43 2016 +0100
@@ -330,7 +330,7 @@
 
             else:
                 # we can now send the blog
-                mb_data['content_rich'] =  content.decode('utf-8')
+                mb_data['content_rich'] =  content.decode('utf-8-sig') # we use utf-8-sig to avoid BOM
 
                 if item_ori_mb_data is not None:
                     mb_data['id'] = item_ori_mb_data['id']
@@ -465,7 +465,7 @@
 
     def updateContent(self):
         with open(self.content_file_path, 'rb') as f:
-            content = f.read().decode('utf-8')
+            content = f.read().decode('utf-8-sig')
             if content and self.syntax != 'XHTML':
                 # we use safe=True because we want to have a preview as close as possible to what the
                 # people will see