Merge pull request #911 from menghanl/grpc_message_decode
Use strconv.ParseUint in decodeGrpcMessage to support non-ascii desc
This commit is contained in:
Коммит
6d7caeea7c
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче