Closed bujike closed 4 years ago
nsq treats the message body as bytes, it is not involved in encoding or decoding the message body. Go's json.Marshal()
will encode the json as utf8, maybe there is some issue in the php consumer, maybe some charset/encoding mixup (utf8 vs utf16-le vs GBK vs whatever).
It was before when i user php client for producer and consumer and It was normal,but recently, i decide to use go-nsq for producer and php client for consumer . I found special character like '【】' and chinese character can not be obvious normaly. anyone have meet the same question . My producer code is like this
data = map[string]interface{}{ "chinese_name" : "张三", "english_name" :"hawk", } body := []map[string]interface{}{data} params := map[string]interface{}{ "args": body, } dataByte, err := json.Marshal(params) if err != nil { panic(err) } p.Publish("wechat_tpl_send", dataByte)