|
Boost Users : |
Subject: [Boost-users] [Format] Formatting some string chars not encoding to hex
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2019-01-22 22:35:58
Hello,
I've got some characters that are not formatting to hex properly. They
are not being interpreted correctly by the strongly typed Format.
For instance, consider the format string:
const char x = '$'; // also, '_', for instance
const auto s = (boost::format("\\x%1$02x") % x).str();
I would expect this to encode to: "\\x24", however, instead this
encodes to "\\x0$".
I would expect '_' to encode: "\\x5f", however, this encodes to "\\x0_".
In a few words, the encoding is "seeing" the char as a literal char
instead of as an "integer".
Although I could possibly trap for this as being the case, I do not
think that I should.
Thoughts? Format authors?
Best regards,
Michael Powell
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net