- Fixed bug #917, which mis-encoded quotes (thanks to Uli Martens).
- Added unit tests.
- Minor unrelated edits.
This commit is contained in:
Paul Beckingham
2012-02-02 22:58:36 -05:00
parent 89b5c91a35
commit 2ce9322a28
5 changed files with 70 additions and 8 deletions

View File

@@ -67,10 +67,10 @@ Nibbler::Nibbler (const std::string& input)
////////////////////////////////////////////////////////////////////////////////
Nibbler::Nibbler (const Nibbler& other)
: _input (other._input)
, _length (other._length)
, _cursor (other._cursor)
{
_input = other._input;
_length = other._length;
_cursor = other._cursor;
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -25,7 +25,6 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <ViewTask.h>

View File

@@ -492,14 +492,12 @@ unsigned burndown_size (unsigned ntasks)
////////////////////////////////////////////////////////////////////////////////
// Encode values prior to serialization.
// " -> &dquot;
// [ -> &open;
// ] -> &close;
const std::string encode (const std::string& value)
{
std::string modified = value;
str_replace (modified, "\"", "&dquot;");
str_replace (modified, "[", "&open;");
str_replace (modified, "]", "&close;");
@@ -521,14 +519,14 @@ const std::string decode (const std::string& value)
std::string modified = value;
// Supported encodings.
str_replace (modified, "&dquot;", "\"");
str_replace (modified, "&quot;", "'");
str_replace (modified, "&open;", "[");
str_replace (modified, "&close;", "]");
// Support for deprecated encodings. These cannot be removed or old files
// will not be parsable. Not just old files - completed.data can contain
// tasks formatted/encoded using these.
str_replace (modified, "&dquot;", "\"");
str_replace (modified, "&quot;", "'");
str_replace (modified, "&squot;", "'"); // Deprecated 2.0
str_replace (modified, "&comma;", ","); // Deprecated 2.0
str_replace (modified, "&colon;", ":"); // Deprecated 2.0