Properly encode unicode binary chars, closes #961