Why do you create a new buffer? Can't you just use `input`? `encodeBytesToChar` will only pull at most three bytes out of it anyways.