Properly handle unicode in key parsing

Fixes #139