Issue #1877 - move patch to locale_string_is_safe function