diff options
Diffstat (limited to 'cpp/src/IceGrid/Util.cpp')
-rw-r--r-- | cpp/src/IceGrid/Util.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cpp/src/IceGrid/Util.cpp b/cpp/src/IceGrid/Util.cpp index d3b6b998738..704f093f24a 100644 --- a/cpp/src/IceGrid/Util.cpp +++ b/cpp/src/IceGrid/Util.cpp @@ -100,14 +100,23 @@ IceGrid::createProperty(const string& name, const string& value) string IceGrid::escapeProperty(const string& s) { + size_t firstChar = s.find_first_not_of(' '); + size_t lastChar = s.find_last_not_of(' '); string result; for(unsigned int i = 0; i < s.size(); ++i) { char c = s[i]; switch(c) { - case '\\': case ' ': + if(i < firstChar || i > lastChar) + { + result.push_back('\\'); + } + result.push_back(c); + break; + + case '\\': case '#': case '=': result.push_back('\\'); |