ProtoAdapter.STRING.encodeWithTag adding extra characters #2087
Unanswered
venkatduddu
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The protobuf spec mandates all values have a tag and all non-scalar's be length prefixed. So no you cannot avoid those characters. What are you trying to do? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm trying to encode the data using ProtoAdapter.STRING for value
618d2cde-31a6-485d-8231-36a322b4dbc8
and when I decode the same data I see data is prefixed with\n$
i.e decoded data looks like\n$618d2cde-31a6-485d-8231-36a322b4dbc8
. Is this expected?Actual call looks like
ProtoAdatapter.STRING.encodeWithTag(protoWriter, tagValue, "618d2cde-31a6-485d-8231-36a322b4dbc8");
When I debugged this further I found that in
internal inline fun <E> ProtoAdapter<E>.commonEncodeWithTag
afterwriter.writeTag(tag, fieldEncoding)
\n
is being added and writer.writeVarint32(encodedSize(value)) adds$
Can I get some help in avoiding those chars?
Beta Was this translation helpful? Give feedback.
All reactions