【发布时间】:2017-01-21 22:49:00
【问题描述】:
我正在使用 gob.NewEncoder 对字符串消息 msg 进行编码,但需要在 utf-8 中进行。
err= gob.NewEncoder(conn).Encode(msg)
我在 Ruby 接收器 (Logstash) 中收到警告,说 收到的事件与您配置的字符编码不同 ...:expected_charset=>"UTF-8"
【问题讨论】:
我正在使用 gob.NewEncoder 对字符串消息 msg 进行编码,但需要在 utf-8 中进行。
err= gob.NewEncoder(conn).Encode(msg)
我在 Ruby 接收器 (Logstash) 中收到警告,说 收到的事件与您配置的字符编码不同 ...:expected_charset=>"UTF-8"
【问题讨论】:
当您调用 Encode(msg) 时,您发送的不是 UTF-8 纯文本。
发送纯文本:
conn.Write([]byte(msg)) // suppose msg is string
【讨论】: