summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/PropertiesI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/PropertiesI.cpp')
-rw-r--r--cpp/src/Ice/PropertiesI.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index 5abd8b6d04c..761d4eec355 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -396,8 +396,24 @@ Ice::PropertiesI::load(const std::string& file)
}
string line;
+ bool firstLine = true;
while(getline(in, line))
{
+ //
+ // Skip UTF8 BOM if present.
+ //
+ if(firstLine)
+ {
+ const unsigned char UTF8_BOM[3] = {0xEF, 0xBB, 0xBF};
+ if(line.size() >= 3 &&
+ static_cast<const unsigned char>(line[0]) == UTF8_BOM[0] &&
+ static_cast<const unsigned char>(line[1]) == UTF8_BOM[1] &&
+ static_cast<const unsigned char>(line[2]) == UTF8_BOM[2])
+ {
+ line = line.substr(3);
+ }
+ firstLine = false;
+ }
parseLine(line, _converter);
}
}