From d3fcd4027949ed4e5d7eb0a6ff3f8ff263b7d4dc Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 5 Aug 2009 07:24:00 -0600 Subject: [PATCH] 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. --- ChangeLog | 2 ++ src/Att.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b74e3532b..f7e22b26c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ confused a subsequent import (thanks to John Florian). + Fixed bug #241 that caused redirected output to retain color control codes for colored header and footnotes (thanks to John Florian). + + Fixed bug #248 where single and double quotes are both stored as + ampersand-quot-semi (thanks to John Florian). ------ old releases ------------------------------ diff --git a/src/Att.cpp b/src/Att.cpp index 6aa09a556..608252c18 100644 --- a/src/Att.cpp +++ b/src/Att.cpp @@ -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; -// " <- " +// " <- " or &dquot; +// ' <- &squot; // , <- , // [ <- &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 (""")) != std::string::npos) // no i18n value.replace (i, 6, "\"");