From 71626dd234ea1fa20ec9f9a3da74f851bbc0f823 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Wed, 9 Apr 2014 22:52:40 +0200 Subject: [PATCH] Remove BOM from Markdown files if needed (ref #86). --- sigal/gallery.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sigal/gallery.py b/sigal/gallery.py index f079215..ac0fd59 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -240,7 +240,8 @@ class Album(UnicodeMixin): descfile = join(self.src_path, self.description_file) if isfile(descfile): - with codecs.open(descfile, "r", "utf-8") as f: + # Use utf-8-sig codec to remove BOM if it is present + with codecs.open(descfile, 'r', 'utf-8-sig') as f: text = f.read() md = markdown.Markdown(extensions=['meta'])