rescue Encoding::CompatibilityError

This commit is contained in:
Pete Matsyburka
2024-03-15 13:44:16 +02:00
parent 0274093c89
commit bd599c264f
2 changed files with 10 additions and 3 deletions
+8
View File
@@ -5,6 +5,14 @@ module TextUtils
module_function
def rtl?(text)
return false if text.blank?
text.match?(TextUtils::RTL_REGEXP)
rescue Encoding::CompatibilityError
false
end
def maybe_rtl_reverse(text)
if text.match?(RTL_REGEXP)
TwitterCldr::Shared::Bidi