From cc02ada3c462d41769b5e0e1413b6fd5e18429be Mon Sep 17 00:00:00 2001 From: NFSL2001 <33471049+NightFurySL2001@users.noreply.github.com> Date: Wed, 1 May 2024 22:29:43 +0800 Subject: [PATCH 1/2] Allow UTF-8 with BOM for features.fea --- Lib/fontTools/feaLib/lexer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/fontTools/feaLib/lexer.py b/Lib/fontTools/feaLib/lexer.py index 5867f70b3..1525d4619 100644 --- a/Lib/fontTools/feaLib/lexer.py +++ b/Lib/fontTools/feaLib/lexer.py @@ -269,7 +269,7 @@ class IncludingLexer(object): fileobj, closing = file_or_path, False else: filename, closing = file_or_path, True - fileobj = open(filename, "r", encoding="utf-8") + fileobj = open(filename, "r", encoding="utf-8-bom") data = fileobj.read() filename = getattr(fileobj, "name", None) if closing: From 80db8cd6f71e149091c43f25db4fe20bf149e252 Mon Sep 17 00:00:00 2001 From: NFSL2001 <33471049+NightFurySL2001@users.noreply.github.com> Date: Wed, 1 May 2024 22:41:03 +0800 Subject: [PATCH 2/2] Allow UTF-8 with BOM for features.fea --- Lib/fontTools/feaLib/lexer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/fontTools/feaLib/lexer.py b/Lib/fontTools/feaLib/lexer.py index 1525d4619..4b6499d06 100644 --- a/Lib/fontTools/feaLib/lexer.py +++ b/Lib/fontTools/feaLib/lexer.py @@ -269,7 +269,7 @@ class IncludingLexer(object): fileobj, closing = file_or_path, False else: filename, closing = file_or_path, True - fileobj = open(filename, "r", encoding="utf-8-bom") + fileobj = open(filename, "r", encoding="utf-8-sig") data = fileobj.read() filename = getattr(fileobj, "name", None) if closing: