diff --git a/ChangeLog b/ChangeLog index 2dff3c10d..d576db53d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,8 @@ Features that are not yet modified. + ColPriority.cpp - Migration of column modification code out of Task.cpp and into the individual column object. + + The configuration file now supports JSON encoding of Unicode characters, by + specifying \uNNNN. + Now requires libuuid (thanks to Martin Natano). Bugs diff --git a/NEWS b/NEWS index ecc78d3ce..1d0aaca4f 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ New configuration options in taskwarrior 2.3.0 - 'taskd.credentials' specifies user credentials for the task server. - 'taskd.certificate' specifies the task server certificate. - 'debug.tls' shows TLS log information, for debugging. + - The configuration file supports JSON encoding of unicode characters \uNNNN. Newly deprecated features in taskwarrior 2.3.0 diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index a816c9ed4..208763f15 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -80,6 +80,8 @@ The hash mark, or pound sign ("#") is used as a comment character. It can be used to annotate the configuration file. All text after the character to the end of the line is ignored. +The configuration file supports UTF8 as well as JSON encoding, such as \\uNNNN. + Note that taskwarrior is flexible about the values used to represent Boolean items. You can use "on", "yes", "y", "1" and "true". Anything else means "off". diff --git a/src/Config.cpp b/src/Config.cpp index 50168cd48..11f15b5e3 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -496,7 +497,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */) std::string key = trim (line.substr (0, equal), " \t"); // no i18n std::string value = trim (line.substr (equal+1, line.length () - equal), " \t"); // no i18n - (*this)[key] = value; + (*this)[key] = json::decode (value); } else { @@ -551,7 +552,7 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data) << "\n"; // Write out the new file. - if (! File::write (rc, contents.str ())) + if (! File::write (rc, json::encode (contents.str ()))) throw format (STRING_CONFIG_BAD_WRITE, rc); } diff --git a/src/commands/CmdConfig.cpp b/src/commands/CmdConfig.cpp index 204d90a5f..d595afb63 100644 --- a/src/commands/CmdConfig.cpp +++ b/src/commands/CmdConfig.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -103,9 +104,9 @@ int CmdConfig::execute (std::string& output) if (confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value))) { if (comment != std::string::npos) - *line = name + "=" + value + " " + line->substr (comment); + *line = name + "=" + json::encode (value) + " " + line->substr (comment); else - *line = name + "=" + value; + *line = name + "=" + json::encode (value); change = true; } @@ -116,7 +117,7 @@ int CmdConfig::execute (std::string& output) if (!found && confirm (format (STRING_CMD_CONFIG_CONFIRM2, name, value))) { - contents.push_back (name + "=" + value); + contents.push_back (name + "=" + json::encode (value)); change = true; } }