Fix unicode bug

Fixes issue #1072