ActionMailer でメールを送信したい。ISO-8859-1 と UTF-8 で同じ csv エンコーディングを送信したい
私のメーラー:
class MyMailer < ActionMailer::Base
default :from => "Me <contact@me.com>"
# ===========
# = Reports =
# ===========
# report is in UTF-8
def send_report(email, report, subject, filename, campaign_id)
attachments[filename + '.utf_8.csv']= { :data => report, :encoding => 'base64', :mime_type => "text/csv" }
attachments[filename + '.latin1.csv']= { :data => report.encode('ISO-8859-1'), :encoding => 'base64', :mime_type => "text/csv; charset=ISO-8859-1" }
@campaign_id = campaign_id
mail(to: email, subject: subject)
end
end
そして、エラーが発生しました:
incompatible character encodings: ISO-8859-1 and UTF-8
それぞれを個別に送信しようとすると、うまく機能します...