Fix xml output for invalid chars (#6431)

This commit is contained in:
Daniel Marjamäki 2016-02-01 18:53:46 +01:00
parent a288d5eb16
commit 39a5400b7d
1 changed files with 2 additions and 7 deletions

View File

@ -242,11 +242,6 @@ std::string ErrorLogger::ErrorMessage::fixInvalidChars(const std::string& raw)
std::ostringstream es;
// straight cast to (unsigned) doesn't work out.
const unsigned uFrom = (unsigned char)*from;
#if 0
if (uFrom<0x20)
es << "\\XXX";
else
#endif
es << '\\' << std::setbase(8) << std::setw(3) << std::setfill('0') << uFrom;
result += es.str();
}
@ -271,7 +266,7 @@ std::string ErrorLogger::ErrorMessage::toXML(bool verbose, int version) const
}
printer.PushAttribute("id", _id.c_str());
printer.PushAttribute("severity", (_severity == Severity::error ? "error" : "style"));
printer.PushAttribute("msg", (verbose ? _verboseMessage : _shortMessage).c_str());
printer.PushAttribute("msg", fixInvalidChars(verbose ? _verboseMessage : _shortMessage).c_str());
printer.CloseElement(false);
return printer.CStr();
}