Fix for non-english email polling.

This commit is contained in:
Robin Ward 2013-11-04 15:30:24 -05:00
parent b8e63719f8
commit c86b06e3fa
3 changed files with 12 additions and 1 deletions

View File

@ -26,7 +26,7 @@ module Email
return Email::Receiver.results[:unprocessable] if @body.blank?
# Then run the github EmailReplyParser on it in case we didn't catch it
@body = EmailReplyParser.read(@body).visible_text
@body = EmailReplyParser.read(@body).visible_text.force_encoding('UTF-8')
discourse_email_parser

View File

@ -50,6 +50,17 @@ stripped from my reply?")
end
end
describe "It supports a non english reply" do
let(:hebrew) { File.read("#{Rails.root}/spec/fixtures/emails/hebrew.eml") }
let(:receiver) { Email::Receiver.new(hebrew) }
it "processes correctly" do
I18n.expects(:t).with('user_notifications.previous_discussion').returns('כלטוב')
receiver.process
expect(receiver.body).to eq("שלום")
end
end
describe "via" do
let(:wrote) { File.read("#{Rails.root}/spec/fixtures/emails/via_line.eml") }
let(:receiver) { Email::Receiver.new(wrote) }

BIN
spec/fixtures/emails/hebrew.eml vendored Normal file

Binary file not shown.