# Single quotes become weird characters in plain-text email

**URL:** <https://www.ruby-forum.com/t/single-quotes-become-weird-characters-in-plain-text-email/85004>\
**Category:** Rails\
**Created:** [February 9, 2007, 5:44am UTC](https://www.ruby-forum.com/t/single-quotes-become-weird-characters-in-plain-text-email/85004 "2007-02-09T05:44:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/898d66/32.png) [@cghost](https://www.ruby-forum.com/u/cghost)\
**Post date:** [February 9, 2007, 5:44am UTC](https://www.ruby-forum.com/t/single-quotes-become-weird-characters-in-plain-text-email/85004/1 "2007-02-09T05:44:46Z")

</div>

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](http://www.collinatorstudios.com/www/budokonmail1.png)

-patrick

this is the code I have currently for mailing email:

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

      begin
         recipients contact.primary_email
         subject newsletter.subject
         from 'removed_email_address@domain.invalid'

         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

```

---

<div class="post-metadata">

**Author:** ![cghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/898d66/32.png) [@cghost](https://www.ruby-forum.com/u/cghost)\
**Post date:** [February 9, 2007, 6:15am UTC](https://www.ruby-forum.com/t/single-quotes-become-weird-characters-in-plain-text-email/85004/2 "2007-02-09T06:15:53Z")

</div>

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
