From 7a40b855312eb69f53f6f4274949b5c87fcbf21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 2 Jan 2019 18:22:12 +0100 Subject: [PATCH] Fixed #8906 (Encoding error in XML message: info attribute) --- lib/errorlogger.cpp | 2 +- test/testerrorlogger.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index 5058c56c2..f1ed62047 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -396,7 +396,7 @@ std::string ErrorLogger::ErrorMessage::toXML() const printer.PushAttribute("file", (*it).getfile().c_str()); printer.PushAttribute("line", std::max((*it).line,0)); if (!it->getinfo().empty()) - printer.PushAttribute("info", it->getinfo().c_str()); + printer.PushAttribute("info", fixInvalidChars(it->getinfo()).c_str()); printer.CloseElement(false); } for (std::string::size_type pos = 0; pos < mSymbolNames.size();) { diff --git a/test/testerrorlogger.cpp b/test/testerrorlogger.cpp index 8dba23d78..e174cb8f3 100644 --- a/test/testerrorlogger.cpp +++ b/test/testerrorlogger.cpp @@ -197,6 +197,7 @@ private: void ToXmlV2Locations() const { std::list locs = { fooCpp5, barCpp8 }; + locs.back().setinfo("รค"); ErrorMessage msg(locs, emptyString, Severity::error, "Programming error.\nVerbose error", "errorId", false); std::string header("\n\n"); header += " \n", ErrorLogger::ErrorMessage::getXMLFooter()); std::string message(" \n"; - message += " \n"; + message += " \n"; message += " \n "; ASSERT_EQUALS(message, msg.toXML()); }