nix-log2xml: Handle UTF-8 characters

C++ chars can be negative...
This commit is contained in:
Eelco Dolstra 2014-08-13 19:00:07 +02:00
parent 9367046fef
commit e9b609bf9a

View file

@ -137,7 +137,7 @@ void Decoder::finishLine()
if (line[i] == '<') cout << "&lt;";
else if (line[i] == '&') cout << "&amp;";
else if (line[i] == '\r') ; /* ignore carriage return */
else if (line[i] < 32 && line[i] != 9) cout << "&#xfffd;";
else if (line[i] >= 0 && line[i] < 32 && line[i] != 9) cout << "&#xfffd;";
else if (i + sz + 33 < line.size() &&
string(line, i, sz) == storeDir &&
line[i + sz + 32] == '-')