* Escape ASCII characters < 32 to Unicode FFFD (REPLACEMENT CHARACTER)

so that we don't produce un-wellformed XML.
This commit is contained in:
Eelco Dolstra 2005-08-01 13:39:19 +00:00
parent f450c8ea2f
commit c680f835c9

View file

@ -117,10 +117,11 @@ void Decoder::finishLine()
if (priority != 1) cout << " priority='" << priority << "'"; if (priority != 1) cout << " priority='" << priority << "'";
cout << ">"; cout << ">";
for (int i = 0; i < line.size(); i++) { for (unsigned int i = 0; i < line.size(); i++) {
if (line[i] == '<') cout << "&lt;"; if (line[i] == '<') cout << "&lt;";
else if (line[i] == '&') cout << "&amp;"; else if (line[i] == '&') cout << "&amp;";
else if (line[i] < 32 && line[i] != 9) cout << "&#xfffd;";
else if (i + sz + 33 < line.size() && else if (i + sz + 33 < line.size() &&
string(line, i, sz) == storeDir && string(line, i, sz) == storeDir &&
line[i + sz + 32] == '-') line[i + sz + 32] == '-')