use correct encoded string buffer length. fixes #19