Added support for non-UTF8 locales