Skip to content Skip to sidebar Skip to footer

Serialization Problem Using Protobuf Between Python And Nodejs

I got a compatible problem when serialize a protobuf message between python and nodejs. I have a protobuf message like the one below: message User { reserved 2,3; string user_i

Solution 1:

It looks like you have some sort of UTF-8 encoding problem when passing around the serialized blobs. The original serialized bytes (from Python) have a byte 0xDE in them, but the node.js version you quote has 0xC3 0x9E instead, which is the UTF-8 encoding of the Unicode code point U+00DE.

I suggest you use an ASCII-safe encoding such as base64 to pass around the blobs for debugging purposes, just to be on the safe side. Once that works, you can make sure that you open all the relevant files and streams in binary mode.

Post a Comment for "Serialization Problem Using Protobuf Between Python And Nodejs"