Thanks for the quick response Jason. Just to be clear, are you saying
that I will not be able to send a String representation from Java to C+
+ and expect it to work.

In term of the sending code:
-------
String text = person.toByteString().toStringUtf8();
//or toString(charsetName)
TextMessage tm = session.createTextMessage();
tm.setText (text);
//send
------

1) Once received the text payload will NOT be able to be used to
create a Person on the C++ side using Message::ParseFromString() ?
Or is it just that the above code is inncorrect? Could I use a
different charset?

2) However, the above code would work to send GPBs from Java to Java
as String representations over JMS for example, correct?


On Oct 6, 1:03 pm, Jason Hsueh <jas...@google.com> wrote:
> On Thu, Oct 6, 2011 at 9:49 AM, Jerry <gerald.d....@gmail.com> wrote:
> > Simple ( hopefully ) question. I am sending a protocol buffer message
> > from windows over EMS to a C++ process that is running on linux. The
> > text payload is generated  as follows on my windows system:
>
> > person.toByteString().toStringUtf8().
>
> Serialized protos are not valid UTF8, and you should never operate on them
> as Java String objects. You'll get data corruption on the other side, making
> it unparsable.
>
>
>
> > When the c++ side attempts to reanimate my person with the following
> > code:
>
> > google:protobuf::TextFormat:parseFromString(dataString, &person);
>
> You used the binary format above, but are using the text format here. You
> should be using Message::ParseFromString() or a similar variant; TextFormat
> should be paired with the Java TextFormat class.
>
>
>
>
>
> > The following error is produced:
>
> > "Invalid control characters encountered in text"
>
> > Any help would be greatly appreciated.
>
> > Also, for reasons that are beside the point I am unable to send a
> > bytes[] between processes at this time.
>
> > Thanks
> > -Jerry
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Protocol Buffers" group.
> > To post to this group, send email to protobuf@googlegroups.com.
> > To unsubscribe from this group, send email to
> > protobuf+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/protobuf?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to