diff --git a/code/osapi/osregistry.cpp b/code/osapi/osregistry.cpp index b45018e2395..5e941188258 100644 --- a/code/osapi/osregistry.cpp +++ b/code/osapi/osregistry.cpp @@ -621,8 +621,15 @@ static Profile *profile_read(const char *file) IniSection *sp = nullptr; KeyValue **kvp_ptr = nullptr; + bool first_line = true; while ((str = read_line_from_file(fp)) != nullptr) { + // some editors save a UTF-8 byte order mark, which would hide the first section header + if (first_line && !strncmp(str, "\xEF\xBB\xBF", 3)) { + memmove(str, str + 3, strlen(str + 3) + 1); + } + first_line = false; + char *ptr = trim_string(str); if (*ptr == '[') {