Hi Gavin, you need pathed pg gem to use PostgreSQL + 1.9.1 + Sequel to work with UTF-8. I'm using Merb + Sequel + the patched PG gem without any problems. You also need to set db connection to the UTF-8 as you've tried.
You can get both patches on: http://rubyforge.org/tracker/index.php?func=detail&aid=25931&group_id=3214&atid=12398 and http://rubyforge.org/tracker/index.php?func=detail&aid=26116&group_id=3214&atid=12398 You need to get source of the ruby-pg gem and patch it. Let me know how it goes. If you've any problems I can put my patched version to Github. Pavel Kunc On Jul 18, 9:34 pm, Gavin Kistner <[email protected]> wrote: > Using Sequel 3.2, Ruby 1.9.1p0, Postgres 8.3.5 and pg 0.8.0. > How can I get a utf-8 string back from Sequel? > > ### psql command line > phrogz=# \l > List of databases > Name | Owner | Encoding > -----------+------------+---------- > phrogz | abcde | UTF8 > > phrogz=# select title from nodes where name='resume'; > title > -------- > résumé > (1 row) > > phrogz=# SHOW client_encoding; > client_encoding > ----------------- > UTF8 > (1 row) > > ### ruby > # I've also tried 'utf8' and 'unicode' as encoding strings > DB = Sequel.connect( 'postgres://ab...@localhost/ > phrogz', :encoding=>'UTF8' ) > class NodeType < Sequel::Model; end > > resume = ::Node[ :name=>'resume' ] > p resume.title.inspect, resume.title.encoding > > "\"r\\xC3\\xA9sum\\xC3\\xA9\"" > #<Encoding:ASCII-8BIT> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
