From b2768b7abd3fb4e450a976a3bd3c50b910ffe585 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Thu, 24 Apr 2014 23:54:42 +0200 Subject: [PATCH] Work around boost::format bug See https://svn.boost.org/trac/boost/ticket/9360 It seems that the %X specifier is ignored if the input value is a char type and the char is instead output verbatim and not in its integer value. Casting it to an int works around this. --- src/string_codec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string_codec.cpp b/src/string_codec.cpp index 5e48d214a..6e19c7fbb 100644 --- a/src/string_codec.cpp +++ b/src/string_codec.cpp @@ -45,7 +45,7 @@ std::string inline_string_encode(const std::string &input) { auto format = boost::format("#%02X"); for (char c : input) { if (c <= 0x1F || c == 0x23 || c == 0x2C || c == 0x3A || c == 0x7C) - output += str(format % c); + output += str(format % (int)(unsigned char)c); else output += c; }