On 07/11/2013 02:01 AM, Rajesh Khan wrote:
I am attempting to enclose a binary message in C++ and trying to receive it
at C#
here is what I am doing
in my c++
std::string ser = obj.SerializeAsString();
response.setContent(ser); //This is a message type;
and in C#
String resp = response.GetContent();
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(resp);
obj = obj.CreateBuilder().MergeFrom(bytes).Build();
Try changing the c# part to do:
byte[] bytes;
response.GetContent(bytes);
obj = obj.CreateBuilder().MergeFrom(bytes).Build();
The 'string' you send from c++ is simply a sequence of bytes, not
necessarily a utf8 string (and if its the google buffer serialised data
its quite likely its not UTF8!).
any suggestion on what I might be doing wrong ? I am using google protocol
buffer from serializat in C++ and deserialization in C#
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]