Fix string key support

Keys must now be buffers or strings of a sane encoding (not utf-8 or ucs2).

Signed-off-by: Eli Skeggs <skeggse@gmail.com>
rebase on master