From 4b9bd499eb857a345e63079015bc6a34c4fcf98a Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Mon, 21 Aug 2017 22:39:26 -0300 Subject: [PATCH] Fix to_hex_if_need function on string utils This fix issue #1535. Solution was the same suggested on #1523. --- src/utils/string.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/string.cc b/src/utils/string.cc index 5b83ad22..f0009396 100644 --- a/src/utils/string.cc +++ b/src/utils/string.cc @@ -136,7 +136,7 @@ std::string toHexIfNeeded(const std::string &str) { std::stringstream res; for (int i = 0; i < str.size(); i++) { - int c = str.at(i); + int c = (unsigned char)str.at(i); if (c < 32 || c > 126) { res << "\\x" << std::setw(2) << std::setfill('0') << std::hex << c; } else {