handle UnicodeEncodeError for systems which have a non-utf-8 locale