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.
This commit is contained in:
Niels Martin Hansen 2014-04-24 23:54:42 +02:00
parent 3f08b1d057
commit b2768b7abd

View file

@ -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;
}