* Escape ASCII characters < 32 to Unicode FFFD (REPLACEMENT CHARACTER)
so that we don't produce un-wellformed XML.
This commit is contained in:
parent
f450c8ea2f
commit
c680f835c9
1 changed files with 2 additions and 1 deletions
|
@ -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 << "<";
|
if (line[i] == '<') cout << "<";
|
||||||
else if (line[i] == '&') cout << "&";
|
else if (line[i] == '&') cout << "&";
|
||||||
|
else if (line[i] < 32 && line[i] != 9) cout << "�";
|
||||||
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] == '-')
|
||||||
|
|
Loading…
Reference in a new issue