Re: [protobuf] [De]serialization of messages to java strings

2009-11-24 Thread Will Morton
2009/11/25 Adam Vartanian : >> What am I doing wrong?  What's the best way to do java string >> serialization of protobuf messages? > > If you absolutely have to pass things around as a String, you're going > to need to do so in some kind of encoding that supports arbitrary > data.  For example, yo

[protobuf] [De]serialization of messages to java strings

2009-11-24 Thread Will Morton
Hello all; I need to serialize a protobuf message to a string so that it can be passed outside my program. The below fails, I'm guessing due to UTF8 encoding issues: byte[] arr = msg.toByteArray(); String str = new String(arr); // ... pass str around ... MsgType msg2 = MsgType.parseFrom(str.getB