#184·grpcurl

Any encoding of the symbols?

Author: yiyue115Created Sep 4, 2020Updated Oct 9, 2025

Hi,

I have a struct in this format

type Response struct {
	Url            string   `protobuf:"bytes,1,opt,name=url,json=url,proto3" json:"url,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

I set it as

return &Response{
        Url: "https://abcd.com/&abcd"
}

When I make the request, I got this response

{
  "url": "https://abcd.com/\u0026abcd"
}

The \u0026 should be & here but I don't know why it appears to be encoded. I wonder whether that's what grpcurl does? Because I haven't found anything with my code which does the encoding...