fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

incorrect decoding of map keys in the response message

shalamai opened this issue · comments

hey, i experienced a weird bug
i get wrong response if map key contains non-ascii character

steps to reproduce:

write grpc server with such endpoint:

  1. it returns a map
    e.g.
message HelloResponse {
    map<string, string> map = 1;
}
  1. a key of the map contains a non ascii character (character which is represented via more than one byte in utf-8)
    e.g. ❤ https://unicode-table.com/en/2764/
{
  "map": { 
    "❤": "map value"
  }
}

expected response (i get it when i call it with other grpc libraries)

{
  "map": { 
    "❤": "map value"
  }
}

actual response

{
  "map": {
    "\342\235\244": "map value"
  }
}

p.s. \342\235\244 is an octal representation of ❤ https://unicode-table.com/en/2764/

UPD:
i debugged a bit and found out that grpculr is fine. the library grpcdynamic from protoreflect that you use to make the actual grpc call here returns wrong response
will debug that library. seem like the issue is there