rescue Encoding::CompatibilityError

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

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

@ -5,6 +5,14 @@ module TextUtils
module_function 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) def maybe_rtl_reverse(text)
if text.match?(RTL_REGEXP) if text.match?(RTL_REGEXP)
TwitterCldr::Shared::Bidi TwitterCldr::Shared::Bidi

Loading…
Cancel
Save