# Should I be using UTF-8 mysql tables/database?

**URL:** <https://www.ruby-forum.com/t/should-i-be-using-utf-8-mysql-tables-database/155103>\
**Category:** Rails\
**Created:** [December 8, 2008, 5:18am UTC](https://www.ruby-forum.com/t/should-i-be-using-utf-8-mysql-tables-database/155103 "2008-12-08T05:18:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![will](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://www.ruby-forum.com/u/will)\
**Post date:** [December 8, 2008, 5:18am UTC](https://www.ruby-forum.com/t/should-i-be-using-utf-8-mysql-tables-database/155103/1 "2008-12-08T05:18:34Z")

</div>

Hi,

Should I be using mysql tables/daatbase encoded in UTF-8 instead of  
the default latin1? What are the benefits of one vs. the other?

There is the possibility of needing to support other languages in the  
future. We currently are running the latest ruby 1.8 and rails 2.1  
(will probably upgrade to 2.2 in the near future).

Many thanks,

Will

---

<div class="post-metadata">

**Author:** ![will](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://www.ruby-forum.com/u/will)\
**Post date:** [December 8, 2008, 3:51pm UTC](https://www.ruby-forum.com/t/should-i-be-using-utf-8-mysql-tables-database/155103/2 "2008-12-08T15:51:12Z")

</div>

> Should I be using mysql tables/daatbase encoded in UTF-8 instead of  
> the default latin1? What are the benefits of one vs. the other?
> 
> There is the possibility of needing to support other languages in the  
> future. We currently are running the latest ruby 1.8 and rails 2.1  
> (will probably upgrade to 2.2 in the near future).  
> I think you just answered your own question. The reason to use UTF-8  
> would be to support other languages, especially languages that are not  
> based on latin.

---

<div class="post-metadata">

**Author:** ![will](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://www.ruby-forum.com/u/will)\
**Post date:** [December 8, 2008, 4:00pm UTC](https://www.ruby-forum.com/t/should-i-be-using-utf-8-mysql-tables-database/155103/3 "2008-12-08T16:00:55Z")

</div>

Robert W. wrote:

> > Should I be using mysql tables/daatbase encoded in UTF-8 instead of  
> > the default latin1? What are the benefits of one vs. the other?
> > 
> > There is the possibility of needing to support other languages in the  
> > future. We currently are running the latest ruby 1.8 and rails 2.1  
> > (will probably upgrade to 2.2 in the near future).

> I think you just answered your own question. The reason to use UTF-8  
> would be to support other languages, especially languages that are not  
> based on latin.

I thought UTF-8 was the default for HTML, and therefor the default for  
The Web,  
unless otherwise specified.

However, in the words of Joel Spolsky, “There is no such thing as plain  
text”.  
If you chose not to decide which encoding to use, you still have made a  
choice…

–  
Phlip

---

<div class="post-metadata">

**Author:** ![will](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://www.ruby-forum.com/u/will)\
**Post date:** [December 9, 2008, 3:06am UTC](https://www.ruby-forum.com/t/should-i-be-using-utf-8-mysql-tables-database/155103/4 "2008-12-09T03:06:53Z")

</div>

Rails 2.x handles all text as UTF-8 by default. My question is if  
mysql should be utf-8 as well. Is there any benefit leaving the mysql  
database as latin1?

---

<div class="post-metadata">

**Author:** ![will](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/90ced4/32.png) [@will](https://www.ruby-forum.com/u/will)\
**Post date:** [December 9, 2008, 7:42am UTC](https://www.ruby-forum.com/t/should-i-be-using-utf-8-mysql-tables-database/155103/5 "2008-12-09T07:42:55Z")

</div>

More and more MYSQL seems to be heading into needing to set your table  
into the necessary language set. Some people suggest leaving it in  
Latin has better performance etc, but I have been putting the data  
into UTF-8 tables for compatibility, this seems to be the cleanest  
when using MYSQL dumps and moving data to use the data in other  
locations without all the characters getting screwed up.

But if you want to keep it in Latin you can, but I suggest not to.

Cheers

Richard
