diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index e39630eb63..4c288f5f21 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -10,6 +10,7 @@ #include #include +#include #include // IWYU pragma: keep #include #include @@ -609,8 +610,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) continue; } - if ((c >= 0x20 && c < 0x7F) || c == '\t' || - (c == '\n' && newline_consume)) { + if (c >= 0 && c <= 0xFF && + (isprint(c) || c == '\t' || (c == '\n' && newline_consume))) { // This is an ASCII character that may be part of a string. // Cast added to avoid compiler warning. Cast is ok because // c is guaranteed to fit in char by the above if...