1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

skip utf8 BOM in config file

This commit is contained in:
IntelOrca
2015-02-16 23:51:04 +00:00
parent 7f0ed995b5
commit af1d5faa90

View File

@@ -250,6 +250,12 @@ bool config_open(const utf8string path)
lineBufferCapacity = 64;
lineBuffer = malloc(lineBufferCapacity);
lineLength = 0;
// Skim UTF-8 byte order mark
fread(lineBuffer, 3, 1, file);
if (!(lineBuffer[0] == 0xEF && lineBuffer[1] == 0xBB && lineBuffer[2] == 0xBF))
fseek(file, 0, SEEK_SET);
while ((c = fgetc(file)) != EOF) {
if (c == '\n' || c == '\r') {
lineBuffer[lineLength++] = 0;