Fix hex encoding of non-ASCII characters in serial

This commit is contained in:
Dan Sorahan 2017-05-04 12:38:19 +01:00 committed by GitHub
parent 9df559598a
commit 165bfa3dd6
1 changed files with 2 additions and 1 deletions

View File

@ -114,7 +114,8 @@ static std::string
hexEncode (std::string const& str) {
std::ostringstream oss;
for (size_t i = 0; i < str.size(); ++i) {
int c = str[i];
unsigned c = str[i];
c %= 256;
oss << std::setfill('0') << std::hex << std::setw(2)
<< std::uppercase;
oss << c;