Fix for non-utf8 environments.