Quoting Felipe Pieretti Umpierre <li...@ruby-forum.com>:
> Jeffrey L. Taylor wrote in post #1044767:
> > Quoting Felipe Pieretti Umpierre <li...@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
> 
> 1.9.3-p0 :003 > group = Group.first
>   Group Load (0.8ms)  SELECT `groups`.* FROM `groups` LIMIT 1
>  => #<Group id: 1, name: "Felipe", description: "ahsidaus", created_at: 
> "2012-02-08 22:32:26", updated_at: "2012-02-08 22:32:26">
> 1.9.3-p0 :004 > group.description
>  => "ahsidaus"
> 1.9.3-p0 :005 > group.description.encoding
>  => #<Encoding:ASCII-8BIT>
> 
> My encoding is different...
> 

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:

>> require 'active_record'
>> Group.first
>> Mysql2::VERSION 
=> "0.3.11"


"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".

HTH,
  Jeffrey

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to