We were converting the data in case it was not UTF-8, but failed to put it into the buffer correctly.