mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-25 16:41:35 +00:00
Improve signature/vacation file handling
Strip BOM_UTF8 from encoded data read by readFile; Windows puts a BOM_UTF8 in UTF-8 files.
This commit is contained in:
@@ -402,7 +402,10 @@ def readFile(filename, mode=u'rb', continueOnError=False, displayError=True, enc
|
||||
return f.read()
|
||||
else:
|
||||
with codecs.open(filename, mode, encoding) as f:
|
||||
return f.read()
|
||||
content = f.read()
|
||||
if not content.startswith(codecs.BOM_UTF8):
|
||||
return content
|
||||
return content.replace(codecs.BOM_UTF8, u'', 1)
|
||||
else:
|
||||
return unicode(sys.stdin.read())
|
||||
except IOError as e:
|
||||
|
||||
Reference in New Issue
Block a user