I checked the code, and AFAICT, the error you are getting should only happen
with "string" fields, not "bytes".  I wrote a test to make sure and, sure
enough, assigning a non-ASCII str to a "bytes" field worked fine.  Can you
write a small program demonstrating the problem for us to debug?

On Tue, Jun 16, 2009 at 6:22 AM, aronb <aronbierb...@gmail.com> wrote:

> We are working on a project where we are sending UUIDs between a
> backedn written in C++ and a Python front end. Our proto file
> specifies that we want to store these UUIDs in byte fields. This maps
> to a std::string in C++ which we can assign to manually. We are
> running into a problem on the Python side though because assigning the
> raw 16 bytes to the string field in Python gives us the following:
> exceptions.ValueError: ':\x19\x14\xd1Y\xf7\x11\xde\x9c[\x00\x1eO\xf3!
> \xd8' isn't in 7-bit ASCII encoding.
> This does make sense because Python is ensuring that the value is
> actually a string. My question then is how can we encode a UUID into a
> 16 byte data structure correctly? Is there a plan to fully support the
> "bytes" field type instead of simply mapping it to a string type?
> Thanks,
> Aron
> >

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 
For more options, visit this group at 

Reply via email to