Single quotes become weird characters in plain-text email

When sending plain-text via a rails app, I am finding that single quotes
cause a very strange character code to appear… I am wondering what
the cause of this is, and how to fix it. This is how the email
appears… notice the problem with “MEN’S” and “WOMEN’S”:

http://www.collinatorstudios.com/www/budokonmail1.png

-patrick

this is the code I have currently for mailing email:

class Mailer < ActionMailer::Base
   def send_newsletter(newsletter, contact)
      return false unless contact.primary_email && contact.primary_email
=~ /\[email protected]\w+\.[\w.]+/

      begin
         recipients contact.primary_email
         subject newsletter.subject
         from '[email protected]'

         part "text/plain" do |p|
            if newsletter.newsletter.length == 0
               p.body = ""
            else
               greeting = contact.first_name || 'Hello'
               p.body = "#{greeting},\n\n" + newsletter.newsletter
            end
         end

         newsletter.attachments.each do |attachment|
            part attachment.content_type do |p|
               p.body = attachment.contents
               p.filename = attachment.filename
               p.transfer_encoding = 'base64'
            end
         end
      rescue
         return false
      end

      return true
   end
end

You are not using ASCII single quotes. If you were, that would not
happen. The program you are using to write the e-mail body is using
“smart quotes”. Use a plain text editor to compose the message, or
include a mail header identifying the encoding of the body as UTF-8.

Cheers,

Luciano

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs