utf-8 fixes and tests