Skip to content
Snippets Groups Projects
Commit 9d4fc96c authored by mads's avatar mads
Browse files

add fix for htc files with BOM

parent 3876bfa0
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -72,7 +72,9 @@ class HTCFile(HTCContents, HTCDefaults):
self.htc_inputfiles.append(filename)
htc_lines = []
with open(filename, encoding='cp1252') as fid:
lines = fid.readlines()
lines = list(fid.readlines())
if lines[0].encode().startswith(b'\xc3\xaf\xc2\xbb\xc2\xbf'):
lines[0] = lines[0][3:]
for l in lines:
if l.lower().lstrip().startswith('continue_in_file'):
filename = l.lstrip().split(";")[0][len("continue_in_file"):].strip()
......
......@@ -241,6 +241,11 @@ class TestHtcFile(unittest.TestCase):
def test_ansi(self):
htcfile = HTCFile(self.testfilepath + "./ansi.htc")
def test_file_with_BOM(self):
htcfile = HTCFile(self.testfilepath + 'DLC15_wsp11_wdir000_s0000_phi000_Free_v2_visual.htc')
self.assertEqual(str(htcfile)[0], ";")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment