rescue Encoding::CompatibilityError
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user