Been banging my head against this for a while. I have this string:
[18] pry(main)> p.title
=> "Human meat – Wesker and Son butchers at Smithfield Market"
[19] pry(main)> p.title.encoding
=> #<Encoding:UTF-8>
[20] pry(main)> p.title.force_encoding("ascii").encode
=> "Human meat ��� Wesker and Son butchers at Smithfield��Market"
This is called in my email template through ActionMailer, and--as you can probably guess--shows up in my email client equally garbled:
<a href=3D"http://localhost:3000/stuff/12072" =
style=3D"color: #D84D3F; text-decoration: none;">Human meat =EF=BF=BD=EF=BF=
=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD Wesker=
and Son butchers at Smithfield=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=
=BD=EF=BF=BDMarket</a>
Despite my headers seemingly setting the Content-Type
correctly to UTF-8
:
----==_mimepart_5082362f64bbe_36cb3feb84c5a7386303d
Date: Fri, 19 Oct 2012 22:27:11 -0700
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-ID: <5082362f6a388_36cb3feb84c5a738632e9@MacBook-Air.local.mail>
I've read lots on the subject, and despite being very informative, I still have no clue how to get rid of these pesky question marks. What do I have to do to get rid of them (with ruby 1.9.3-p194
)?