Merge pull request #911 from menghanl/grpc_message_decode

Use strconv.ParseUint in decodeGrpcMessage to support non-ascii desc
This commit is contained in:
Qi Zhao
2016-09-27 17:26:54 -07:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@ -352,7 +352,7 @@ func decodeGrpcMessageUnchecked(msg string) string {
for i := 0; i < lenMsg; i++ {
c := msg[i]
if c == percentByte && i+2 < lenMsg {
parsed, err := strconv.ParseInt(msg[i+1:i+3], 16, 8)
parsed, err := strconv.ParseUint(msg[i+1:i+3], 16, 8)
if err != nil {
buf.WriteByte(c)
} else {

View File

@ -135,6 +135,7 @@ func TestDecodeGrpcMessage(t *testing.T) {
{"H%61o", "Hao"},
{"H%6", "H%6"},
{"%G0", "%G0"},
{"%E7%B3%BB%E7%BB%9F", "系统"},
} {
actual := decodeGrpcMessage(tt.input)
if tt.expected != actual {