MODULES-780 Don't blow up on unicode characters.

previous commit is not complete