import person_pb2 import json from google.protobuf import json_format
bidResponse = person_pb2.Person() bidResponse.name = "<iframe src=\"%%%%CLICK_URL_UNESC%%%%https://play.google.com\"></iframe>"" bidResponse.id = 123 bid_resp_bid = bidResponse.number.add() bid_resp_bid.id = 'zhehsi' p1 = bidResponse.SerializeToString() print(p1) ## the result(binary data) like this : b'\nG<iframe src="%%%%CLICK_URL_UNESC%%%%https://play.google.com"></iframe>\x10\xc0\xc4\x07\x1a\x08*\x06zhehsi' bid_esponse = person_pb2.Person() bid_esponse.ParseFromString(p1) p2 = json_format.MessageToDict(bid_esponse) ## parse the result(binary data) get: {'name': '<iframe src="%%%%CLICK_URL_UNESC%%%%https://play.google.com"></iframe>', 'id': 123456, 'number': [{'id': 'zhehsi'}]} as you see ,string" <iframe src=\"%%%%CLICK_URL_UNESC%%%%https://play.google.com"></iframe>" is not be Serialized to binary . It is not changed.But I parse it ,it is right . However google support team said i am wrong.the "iframe tag" must be Serialized to binary,if not they can not parse it. I do not know where i wrong.Can you check my code where is wrong? or can you Serialize the string("<iframe src="%%%%CLICK_URL_UNESC%%%%https://play.google.com"></iframe>") to binary data? -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/c5d60d5a-8455-4ab3-a0d5-310a56a627c4%40googlegroups.com.
