HHH-8491 Improved implementation for locale string parsing