From 3960e4d5afa09c299f595b411ee8522db30580fd Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 11 Dec 2013 21:07:39 +0100 Subject: Functions to provide xml-valid strings By removing invalid chars, see http://www.w3.org/TR/xml/#charsets --- src/test.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/test.cpp') diff --git a/src/test.cpp b/src/test.cpp index a8c0276..958e894 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -52,6 +52,11 @@ int main() assert(from_ascii == "couc�ou"); std::cout << from_ascii << std::endl; + std::string without_ctrl_char("𤭢€¢$"); + assert(utils::remove_invalid_xml_chars(without_ctrl_char) == without_ctrl_char); + assert(utils::remove_invalid_xml_chars(in) == in); + assert(utils::remove_invalid_xml_chars("\acouco\u0008u\uFFFEt\uFFFFe\r\n♥") == "coucoute\r\n♥"); + /** * Utils */ @@ -156,7 +161,7 @@ int main() /** * Config */ - std::cout << color << "Testing JID parsing…" << reset << std::endl; + std::cout << color << "Testing config…" << reset << std::endl; Config::filename = "test.cfg"; Config::file_must_exist = false; Config::set("coucou", "bonjour"); -- cgit v1.2.3