summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/PropertiesI.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2011-03-14 15:30:59 +0100
committerJose <jose@zeroc.com>2011-03-14 15:30:59 +0100
commit908723895df8dc6fd1df5175f93e78b669a9bf4c (patch)
tree93a425db53a7d2104ddcdb64e49ef50f1632bf3d /cpp/src/Ice/PropertiesI.cpp
parent5030 - Patch for slice2cs with scoped constants (diff)
downloadice-908723895df8dc6fd1df5175f93e78b669a9bf4c.tar.bz2
ice-908723895df8dc6fd1df5175f93e78b669a9bf4c.tar.xz
ice-908723895df8dc6fd1df5175f93e78b669a9bf4c.zip
5033 - Configuration files and UTF-8 BOM
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);
}
}