Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Check if CHAR fields are printable #715

Closed
trozen opened this issue Sep 12, 2019 · 2 comments
Closed

[C++] Check if CHAR fields are printable #715

trozen opened this issue Sep 12, 2019 · 2 comments

Comments

@trozen
Copy link
Contributor

trozen commented Sep 12, 2019

Sometimes I'm getting messages with CHAR fields, that are set to 0 for example. This breaks logging, as binary data is mixed with text.

Would it be possible to change the way CHAR fields are printed currently:

            builder << '"' << (char)writer.tradeCondition() << '"';

to something like:

            if (std::isprint(writer.tradeCondition())) {
                builder << '"' << (char)writer.tradeCondition() << '"';
            } else {
                builder << (int)writer.tradeCondition();
            }
@tmontgomery
Copy link
Contributor

Feel free to send a PR for this.

@rigtorp
Copy link
Contributor

rigtorp commented Sep 13, 2019

Remember this will cause the output to be locale dependent.

@trozen trozen closed this as completed Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants