# Question re: Charactersets

**URL:** <https://www.ruby-forum.com/t/question-re-charactersets/158620>\
**Category:** Rails\
**Created:** [January 25, 2009, 11:47pm UTC](https://www.ruby-forum.com/t/question-re-charactersets/158620 "2009-01-25T23:47:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [January 25, 2009, 11:47pm UTC](https://www.ruby-forum.com/t/question-re-charactersets/158620/1 "2009-01-25T23:47:26Z")

</div>

Hi there,

I need some help with characters (charactersets):

I have “special characters” in some db fields. When those fields are  
used for the composition of an email, those “special characters” show up  
screwed up in the email text, for example:

- a ‘Ã¼’ in my db becomes a ‘ÃƒÂ¼’ in the email body.
- a ‘Ã©’ in my db becomes a ‘ÃƒÂ©’ in the email body.

I suppose this has something to do with the choice of the charactersets,  
but I don’t know where the “bug” exactly lies…

in phpMyAdmin, I can see that

- MySQL charset: UTF-8 Unicode (utf8)

Furthermore, I have set the following to “latin1\_general\_ci”:

- MySQL connection collation
- the collation of the entire db
- the collation of all tables
- the collation of all columns (that have the type “varchar”)

And: I used [Collation Charts: MySQL 6.0](http://www.collation-charts.org/mysql60/) to check that my  
charset/collation “latin1\_general\_ci” really _contains_ the characters  
needed (Ã¶, Ã¼, Ã©, etc.), so I think that must be the right choice.

Thank you for any help with this!  
Tom

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [January 26, 2009, 12:38am UTC](https://www.ruby-forum.com/t/question-re-charactersets/158620/2 "2009-01-26T00:38:59Z")

</div>

Ok, here’s the issue, in case anyone is interested  
(internationalization…):

The email client used was Thunderbird. And Thunderbird uses by default  
the following encoding:

Western ISO-8859  
…also known as…  
ISO 8859-2 Central European

So the MySQL db needed to use the same encoding or “the corresponding  
collation” (which is “latin2\_general\_ci”) in order to encode special  
characters such as ‘Ã¼’ or ‘Ã©’ correctly.

([http://dev.mysql.com/doc/refman/5.1/en/charset-charsets.html](http://dev.mysql.com/doc/refman/5.1/en/charset-charsets.html))

Tom

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [January 26, 2009, 1:48am UTC](https://www.ruby-forum.com/t/question-re-charactersets/158620/3 "2009-01-26T01:48:43Z")

</div>

Plus, the mailer model needed one more line:

def my\_mail()  
charset “latin1” # -\> tell it to use Western ISO-8859 encoding  
!  
from blah  
recipients blah  
subject blah  
etc…  
end
