Fix for decoding unicode strings correctly

Fixes #1225