Fix non-unicode strings and locales handling in Vim

Fixes #1071 and #1072.