Bug Fix - Bug #248

- Fixed bug where both single and double quotes are stored as
  ampersand-quote-semi-colon, leading to the gradual conversion of
  one to the other.  Fix is backward compatible.  Thanks to John
  Florian.
This commit is contained in:
Paul Beckingham 2009-08-05 07:24:00 -06:00
parent c4dcdbff0f
commit d3fcd40279
2 changed files with 14 additions and 2 deletions

View file

@ -711,8 +711,11 @@ void Att::encode (std::string& value) const
while ((i = value.find ('\t')) != std::string::npos)
value.replace (i, 1, "&tab;"); // no i18n
while ((i = value.find ('\'')) != std::string::npos)
value.replace (i, 1, "&squot;"); // no i18n
while ((i = value.find ('"')) != std::string::npos)
value.replace (i, 1, """); // no i18n
value.replace (i, 1, "&dquot;"); // no i18n
while ((i = value.find (',')) != std::string::npos)
value.replace (i, 1, ","); // no i18n
@ -730,7 +733,8 @@ void Att::encode (std::string& value) const
////////////////////////////////////////////////////////////////////////////////
// Decode values after parse.
// \t <- &tab;
// " <- &quot;
// " <- &quot; or &dquot;
// ' <- &squot;
// , <- &comma;
// [ <- &open;
// ] <- &close;
@ -742,6 +746,12 @@ void Att::decode (std::string& value) const
while ((i = value.find ("&tab;")) != std::string::npos) // no i18n
value.replace (i, 5, "\t");
while ((i = value.find ("&dquot;")) != std::string::npos) // no i18n
value.replace (i, 7, "\"");
while ((i = value.find ("&squot;")) != std::string::npos) // no i18n
value.replace (i, 7, "'");
while ((i = value.find ("&quot;")) != std::string::npos) // no i18n
value.replace (i, 6, "\"");