ignore BOM

This commit is contained in:
Glenn Maynard
2003-01-05 08:36:33 +00:00
parent d46a2ef9de
commit c275ebdad5
+14
View File
@@ -51,9 +51,23 @@ bool IniFile::ReadFile()
CString line; CString line;
while (getline(file, line)) while (getline(file, line))
{ {
if(line.size() >= 3 &&
line[0] == '\xef' &&
line[1] == '\xbb' &&
line[2] == '\xbf'
)
{
/* Obnoxious NT marker for UTF-8. Remove it. */
line.erase(0, 3);
}
if (line == "") if (line == "")
continue; continue;
if (line.substr(0, 2) == "//" || line.substr(0) == "#")
continue; /* comment */
if (line[0] == '[' && line[line.GetLength()-1] == ']') //if a section heading if (line[0] == '[' && line[line.GetLength()-1] == ']') //if a section heading
{ {
keyname = line; keyname = line;