PostgreSQL8.1 “client encoding mismatch” with ODBC

While connecting to PostgreSQL using UnixODBC (from R, but this doesn’t matter) I got the following error:

[unixODBC]client encoding mismatch

It seems that there is some problem with PostgreSQL 8.1 and the encoding names: see [this post](http://archives.postgresql.org/pgsql-odbc/2005-09/msg00161.php) or [google](http://www.google.com/search?q=%22client+encoding+mismatch%22+postgres). It looks that UTF8 used by default with the new Postgres is not compatible with old ODBC drivers. I am not sure where the problem really is, but a _quick fix_ is to change default encoding for the user connecting to the database:

alter user SET client_encoding to LATIN1;

6 Responses to “PostgreSQL8.1 “client encoding mismatch” with ODBC”

  1. Phil Says:

    Thanks .v.much. You saved me much hassle. You do not happen to know what is the def of old driver ?

    Cheers

    Phil

  2. tadekp Says:
  3. jorge Says:

    loco me sircvio mucho
    gracias

  4. Ismail Y Says:

    Woww… thanks dud,,,, your post was USEFULL..
    my user client_encoding was changed to SQL_ASCII, and “client encoding mismatch” error message just disappear :D

    Thank you sooo much,…

  5. Dan Says:

    Thank you! Problem solved!

  6. Oscar Says:

    me sirvió para conectarme desde el excel 2007 al postresql 8.4 en windows.. Gracias

Leave a Reply