Different interpretation of bytes filed

15 views
Skip to first unread message

Santos Jha

unread,
Dec 13, 2019, 11:48:50 PM12/13/19
to Protocol Buffers

I am currently using proto3. I have a variable declared as bytes in protocol language. I have generated both Java code and C++ code.

In Java, this variable is of type ByteString whereas in C++ it std: string.

I send data from C++ program to java program.

In C++ I set the value as 

std::string *mutSignX=this->eERaRequestMessage->mutable_signx();
mutSignX->assign(xSignString);

Basically eERaRequestMessage encapsulates this variable.

This object is serialized and passed to the java side Where this variable becomes bytestring. 

I print the value on both side I see weird stuff. On C ++ side it is 

5067074999823757705047826352622691465172865869283871351499048344639279650646


Where as on Java site I see following.


34353036373037343939393832333735373730353034373832363335323632323639313436353137323836353836393238333837313335313439393034383334343633393237393635303634362e


I think I am missing something.


Your thoughts will be appreicated.

Reply all
Reply to author
Forward
0 new messages