Ignore BOM in locale files

Ignore BOM at the start of Factorio locale files as this is a thing
Factorio also does.

Fixes #507
This commit is contained in:
Hornwitser committed 2023-11-24 20:53:16 +01:00
1 parent 6eda1f78d5
commit f23e442c4c
3 files changed
+14

No files matched your search

+5
View File
@@ -11,6 +11,11 @@
* @returns sections parsed from the ini file.
*/
export function parse(input: string) {
// Ignore BOM at the start of the file
if (input[0] === "\uFEFF") {
input = input.slice(1);
}
const sections: Record<string, string | Record<string, string>> = {};
let currentSection: Record<string, string> = sections as Record<string, string>;
const lines = input.split(/\r\n|\n/);