[ttx] Strip the BOM only in XML files

This commit is contained in:
Miguel Sousa 2017-03-28 03:00:00 -07:00
parent 1a58912a60
commit fefe5d5c46

View File

@ -285,8 +285,10 @@ def guessFileType(fileName):
f = open(fileName, "rb")
except IOError:
return None
header = f.read(256).lstrip(b'\xef\xbb\xbf')
header = f.read(256)
f.close()
if header.startswith(b'\xef\xbb\xbf<?xml'):
header = header.lstrip(b'\xef\xbb\xbf')
cr, tp = getMacCreatorAndType(fileName)
if tp in ("sfnt", "FFIL"):
return "TTF"