Rails DB defaults to utf8 for mysql -- but unicode for postgresql

Hi,

Creating a new Rails application with -d postgresql sets the encoding in
the database.yml to unicode

Creating a new Rails with -d mysql sets the encoding to utf8

Any ideas why this difference?

I’ve been having problems with encoding due to localization, accents,
json and what no. I thought I was using utf8 and not unicode. Would this
have any impact?

If this would be an issue? What to take into account when doing a change
of that type on a production DB?

Thanks.

On May 21, 12:29am, comopasta Gr [email protected] wrote:

Hi,

Creating a new Rails application with -d postgresql sets the encoding in
the database.yml to unicode

Creating a new Rails with -d mysql sets the encoding to utf8

According to http://www.postgresql.org/docs/8.4/static/multibyte.html
Unicode as an encoding name is just an alias for UTF8. Earlier
versions only list Unicode as the name of that encoding, so I assuming
this means that setting the name unicode ensures that a range of
postgresql versions will use UTF8 (or perhaps the database.yml
template hasn’t been updated from the time where the only name for
UTF8 was Unicode)

Fred

Fred

According to http://www.postgresql.org/docs/8.4/static/multibyte.html
Unicode as an encoding name is just an alias for UTF8. Earlier
versions only list Unicode as the name of that encoding, so I assuming
this means that setting the name unicode ensures that a range of
postgresql versions will use UTF8 (or perhaps the database.yml
template hasn’t been updated from the time where the only name for
UTF8 was Unicode)

Fred

Fred

Yeah I checked the same and saw that UTF8 was listed. But confused
because different opinions regarding their meanings varies. And also
that Rails would make that differentiation.

But checking the db with PgAdmin3 locally I can see this info:

CREATE DATABASE app_development
WITH OWNER = me
ENCODING = ‘UTF8’
TABLESPACE = pg_default
CONNECTION LIMIT = -1;

So ultimately encoding: unicode translates into utf8

Thanks Fred!