From 86ef444b354e5ee4965b2dbe9e2add5d80a55d07 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Tue, 27 Sep 2016 11:52:31 -0700 Subject: [PATCH] Use strconv.ParseUint in decodeGrpcMessage to support non-ascii desc --- transport/http_util.go | 2 +- transport/http_util_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/transport/http_util.go b/transport/http_util.go index b024594e..19dea36f 100644 --- a/transport/http_util.go +++ b/transport/http_util.go @@ -349,7 +349,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 { diff --git a/transport/http_util_test.go b/transport/http_util_test.go index 41bf5477..a5f8a85f 100644 --- a/transport/http_util_test.go +++ b/transport/http_util_test.go @@ -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 {