Re: [DataMapper] postgres adapter and UTF8 encoding

154 views
Skip to first unread message

Abe Voelker

unread,
Sep 6, 2012, 9:20:59 AM9/6/12
to datam...@googlegroups.com
Do you have an encoding set in config/database.yml?  Try setting it to UTF-8 or utf8 (I don't remember which is correct), e.g.
development:
  adapter: postgresql
  encoding: UTF-8
development:
  adapter: postgresql
  encoding: utf8
Also you might want to use the same database in development that you use for staging/production.  It will save you a lot of headache.

On Thu, Sep 6, 2012 at 7:27 AM, Leonid Batizhevsky <the.l...@gmail.com> wrote:
Hello ereryone.

In my sinatra application I use datamapper with postgres and sqlite adapters.

I use sqlite in development and every works fine.

But then I deploy application and try to use with postgres I\ve got strange errors, like:

Encoding Unicode is not a known Ruby encoding for PostgreSQL

and

incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::Compatibili tyError)

Please help me.
Thank you

--
You received this message because you are subscribed to the Google Groups "DataMapper" group.
To view this discussion on the web visit https://groups.google.com/d/msg/datamapper/-/DN2d8qeMnHAJ.
To post to this group, send email to datam...@googlegroups.com.
To unsubscribe from this group, send email to datamapper+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.

Leonid Batizhevsky

unread,
Sep 7, 2012, 12:16:24 AM9/7/12
to datam...@googlegroups.com
Thank you for your response.
My config is:

configure :production do
  DataMapper.setup(:default, {
    :adapter  => 'postgres',
    :encoding => 'UTF8',
    :host     => 127.0.0.1',
    :username => 'user' ,
    :password => 'god',
    :database => 'prod_db}) 
end

And I try to  set all spellings of UTF8 including Unicode(from postgres documentation)
And one more: In production I have FreeBSD (7)  and as default locale installed C (ANSI encoding).

четверг, 6 сентября 2012 г., 17:21:01 UTC+4 пользователь Abe Voelker написал:

Leonid Batizhevsky

unread,
Sep 10, 2012, 3:22:07 AM9/10/12
to datam...@googlegroups.com
UTF-8 encoding works fine. Thank you.

пятница, 7 сентября 2012 г., 8:16:24 UTC+4 пользователь Leonid Batizhevsky написал:
Reply all
Reply to author
Forward
0 new messages