Skip to content

Commit 90f0e34

Browse files
Add error if BOM on first line of po file
1 parent 2e8044a commit 90f0e34

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Tools/i18n/msgfmt.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ def make(filename, outfile):
116116
print(msg, file=sys.stderr)
117117
sys.exit(1)
118118

119+
# Check for UTF-8 BOM
120+
if lines[0].startswith(b'\xef\xbb\xbf'):
121+
print(
122+
f"The file {infile} starts with a UTF-8 BOM which is not allowed in .po files.\n"
123+
"Please save the file without a BOM and try again.",
124+
file=sys.stderr
125+
)
126+
sys.exit(1)
127+
119128
section = msgctxt = None
120129
fuzzy = 0
121130

0 commit comments

Comments
 (0)