Search code examples
c++protocol-buffers

How to interpret the DebugString output of a bytes parameter


I have a bytes parameter which i printout in the terminal using the DebugString method of the protobuf message of which the parameter is a member.

After writing three bytes to the parameter i was expecting something like this:

my_parameter: "\62\364\166"

Where all bytes are written one by one as octal numbers.

This is what i get:

my_parameter: "2\364v"

I cannot even tell what i'm looking at. How many bytes are there in my parameter? What values have been written to it?

I use C++ if that matters.


Solution

  • It seems that all values that are printable (32..127) in the ASCII table are printed as characters, and all other values are printed as /octal, meaning the slash is some kind of escape for a non-printable character. Makes sense (if you don't mind the characters).