diff --git a/lib/email_builder.rb b/lib/email_builder.rb index 2249865c4ba..dabd9ef2a9d 100644 --- a/lib/email_builder.rb +++ b/lib/email_builder.rb @@ -20,6 +20,7 @@ module EmailBuilder body: body } mail_args[:from] = params[:from] || SiteSetting.notification_email + mail_args[:charset] = 'UTF-8' mail(mail_args) end diff --git a/lib/email_sender.rb b/lib/email_sender.rb index 2265a13c787..495542b1805 100644 --- a/lib/email_sender.rb +++ b/lib/email_sender.rb @@ -19,7 +19,8 @@ class EmailSender return if @message.to.blank? return if @message.body.blank? - plain_body = @message.body.to_s + @message.charset = 'UTF-8' + plain_body = @message.body.to_s.force_encoding('UTF-8') @message.html_part = Mail::Part.new do content_type 'text/html; charset=UTF-8' diff --git a/spec/components/system_message_spec.rb b/spec/components/system_message_spec.rb index 2a976f55095..c326568166c 100644 --- a/spec/components/system_message_spec.rb +++ b/spec/components/system_message_spec.rb @@ -13,22 +13,12 @@ describe SystemMessage do let(:post) { system_message.create(:welcome_invite) } let(:topic) { post.topic } - it 'should create a post' do + it 'should create a post correctly' do post.should be_present - end - - it 'should be a private message' do topic.should be_private_message - end - - it 'should have the correct topic subtype' do topic.subtype.should == TopicSubtype.system_message - end - - it 'should be visible by the user' do topic.allowed_users.include?(user).should be_true end - end context '#system_user' do