According to the Neovim documentation, channels can work with raw bytes, meaning Neovim can communicate with external programs using non-UTF-8 bytes.
However, since the function api::chan_send
takes data: &str
as an argument, it cannot handle non-UTF-8 bytes.
Could you consider changing the type of data
to &[u8]
? If you want to pass a &str
, you can simply call as_bytes()
.