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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user