Matt Jones wrote:
> On Nov 2, 5:31�pm, Toby Rodwell <rails-mailing-l...@andreas-s.net>
> wrote:
>> this issue? �Without being an expert in this area (obviously) I guess
>> that either I can try to "tell" Ruby to treat the MySQL data as an
>> encoding other than UTF-8 (I guess US-ASCII �but it could be trial and
>> error to work out what), and/or I could add some rescue code to find
>> (and ignore) bad byte sequences. �I've tried to find recipes for both
>> the above, but quickly get lost in the subtleties of it all! �Any and
>> all help appreciated. �Many thanks in advance.
> 
> I'd check with the whoever admins the MySQL DB to find out what
> character set it's actually using. I think you can then tell the
> adapter to translate. Best guess is either US ASCII, or (more likely)
> Windows-1252 pretending to be ASCII.
> 
> --Matt Jones

Many thanks for the reply Matt.  I used the console to determine that 
the db is serving up ASCII-8BIT

>>e = Equipment.find(:first, :conditions => ['id = ?', 1234])
>> e.name.encoding
=> #<Encoding:ASCII-8BIT>

I then set the encoding in /config/database.yml to 'ascii' which 
although it can't display special characters, at least it shows the page 
with "?" in place of the accented charaters.  I tried setting encoding 
to "ascii-8bit" and varieties of this, but each time Rails complained - 
so if anyone can tell me how to indicate ASCII-8BIT I'd be grateful.

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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