refactor wchar_t code to use utf-8 strings instead