On Nov 3, 10:09 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas-
s.net> wrote:
> Toby Rodwell wrote:
>
> [...]
>
> > 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.
>
> This doesn't solve your immediate problem, but...if your host locks the
> DB in ASCII 8-bit and you can't change it, then find a new host.  That
> encoding is inappropriate for real work. :)
>

This is not about the database itself this is to do with the
interaction between the mysql driver and the new string encoding
schemes - strings in ruby 1.9 are encoding aware and from what I
gather the mysql driver creates strings with the ascii-8bit encoding
regardless of their actual encoding (my very vague understanding is
that ascii-8bit is sort of pseudo encoding that doesn't actually mean
ascii - it just means raw bytes)

There is quite a lot of discussion on lighthouse here:
https://rails.lighthouseapp.com/projects/8994/tickets/2476-ascii-8bit-encoding-of-query-results-in-rails-232-and-ruby-191#ticket-2476-2
although no clear resolution that I could see. May provide some help
to Toby. One way out would be to fall back to ruby 1.8.x, where these
problems do not exist because strings are just dumb collections of
bytes.

Fred


> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> Posted viahttp://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