rescue Encoding::CompatibilityError

pull/220/head^2
Pete Matsyburka 2 years ago
parent 0274093c89
commit bd599c264f

@ -3,10 +3,9 @@
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
</style>
<style></style>
</head>
<body dir="<%= yield&.match?(TextUtils::RTL_REGEXP) ? 'rtl' : 'auto' %>">
<body dir="<%= TextUtils.rtl?(yield) ? 'rtl' : 'auto' %>">
<%= yield %>
<%= render partial: 'shared/mailer_attribution' %>
</body>

@ -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

Loading…
Cancel
Save