utf-8 bom detection and removal

This commit is contained in:
Joseph Reagle 2013-01-23 11:01:13 -05:00
commit e94147cd3a

View file

@ -184,11 +184,12 @@ def get_date(string):
pass
raise ValueError("'%s' is not a valid date" % string)
def pelican_open(path):
def pelican_open(filename):
"""Open a file and return it's content"""
return open(path, encoding='utf-8').read()
content = open(filename, encoding='utf-8').read()
if content[0] == codecs.BOM_UTF8.decode('utf8'):
content = content[1:]
return content
def slugify(value):
"""