diff --git a/src/libutil/xml-writer.cc b/src/libutil/xml-writer.cc index cd37dff5608f0d6d7ce671ec9b92900ccb6ad4c5..27235933e7fb51cafa19f10574629df96e3625c6 100644 --- a/src/libutil/xml-writer.cc +++ b/src/libutil/xml-writer.cc @@ -89,6 +89,9 @@ void XMLWriter::writeAttrs(const XMLAttrs & attrs) if (c == '"') output << """; else if (c == '<') output << "<"; else if (c == '&') output << "&"; + /* Escape newlines to prevent attribute normalisation (see + XML spec, section 3.3.3. */ + else if (c == '\n') output << "
"; else output << c; } output << "\"";