Fix undefined behavior in C++20, see #4735

This commit is contained in:
Benau 2022-02-25 11:13:27 +08:00
parent 09e7a38c52
commit dcdc66b8f5

View File

@ -832,7 +832,8 @@ namespace StringUtils
if (utf32[i] >= 128 || utf32[i] == '&' || utf32[i] == '<' || if (utf32[i] >= 128 || utf32[i] == '&' || utf32[i] == '<' ||
utf32[i] == '>' || utf32[i] == '\"' || utf32[i] == ' ') utf32[i] == '>' || utf32[i] == '\"' || utf32[i] == ' ')
{ {
output << "&#x" << std::hex << std::uppercase << utf32[i] << ";"; unsigned code = (unsigned)utf32[i];
output << "&#x" << std::hex << std::uppercase << code << ";";
} }
else else
{ {