Skip to content

Commit a6bbb1e

Browse files
committed
fix encoding issue
1 parent 3f3d3e7 commit a6bbb1e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

app/mailboxes/newsletter_mailbox.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ def process
2323
private
2424
def extract_content
2525
html_part = mail.parts.find { |part| part.content_type.include?("text/html") }
26+
body = html_part.present? ? html_part.body.decoded : mail.body.decoded
27+
encoded_body = body.force_encoding("UTF-8")
2628

27-
if html_part.present?
28-
format_html(html_part.body&.decoded)
29-
else
30-
mail.body.decoded
31-
end
29+
html_part.present? ? format_html(encoded_body) : encoded_body
3230
end
3331

3432
def format_html(html)

0 commit comments

Comments
 (0)