Quoting Felipe Pieretti Umpierre <lists@ruby-forum.com>:
Everaldo Gomes wrote in post #1044692:
> Hi!
>
> Try to follow Jefrey tip. Because he said that mysql adapter returns
> ASCII-8bit.
>
> You must use
>
> adapter: mysql2
>
> Regards,
> Everaldo
>
> On Tue, Feb 7, 2012 at 9:10 PM, Felipe Pieretti Umpierre <
I tried, but was the same error.
In the Rails console, pick a model, I use Item here, try this, and show us the
result.
i = Item.first
i.title # any string field will do
i.title.encoding
The desired value is:
=> #<Encoding:UTF-8>
A couple of other things, I assume you are using Ruby 1.9, correct? And did
you restart your server after changing database.yml?
Quoting Felipe Pieretti Umpierre <lists@ruby-forum.com>:
Jeffrey L. Taylor wrote in post #1044767:
> Quoting Felipe Pieretti Umpierre <lists@ruby-forum.com>:
>> > Regards,
>> > Everaldo
>> >
>> > On Tue, Feb 7, 2012 at 9:10 PM, Felipe Pieretti Umpierre <
>>
>> I tried, but was the same error.
>>
>
> In the Rails console, pick a model, I use Item here, try this, and show
> us the
> result.
>
>>> i = Item.first
>>> i.title # any string field will do
>>> i.title.encoding
>
> The desired value is:
>
> => #<Encoding:UTF-8>
>
> A couple of other things, I assume you are using Ruby 1.9, correct? And
> did
> you restart your server after changing database.yml?
>
> Jeffrey
This is your problem. The ASCII-8BIT string from the database are conflicting
with UTF-8 strings in your views. Are you sure you are using mysql2? From
the Rails console:
"0.3.11" is the version of Mysql2 on my system. If it is not defined, try
Mysql::VERSION. Presumably that will be defined. You will have to figure out
why the wrong gem is used. At the command line "gem list mysql" will tell
which are installed. Double check config/database.yml for "adapter: mysql2".
I resolved this problem, after re install my ubuntu, and start another
project, I got the same error, so I put mysql2 as adapter and restart my
server.