Hello,
I have a PostgreSQL database in UTF8, if I connect to it using the SQL Editor it uses the win1252 as client encoding and can't work correctly - by some queries I get the error message:
Code 7, State 22P05, ERROR: character with byte sequence 0xc5 0x81 in encoding "UTF8" has no equivalent in encoding "WIN1252"

If I run "set client_encoding utf8" - the queries run without errors.

Is it possible to setup the default client encoding for PostgreSQL connections=

Best regards,
Alex

Thu Apr 21, 2016 5:12 am

SysOpSite Admin

Joined: 26 Nov 2006Posts: 6509

It uses by default the default encoding of your system.

Generally speaking version 7 is not fully Unicode compatible. The next version 8 will fully support Unicode in both scripts and data.

Thu Apr 21, 2016 7:46 am

michalk

Joined: 29 Aug 2014Posts: 142

I followed this subject just because I was curious about it.

I have had already installed 2 versions of postgresql ODBC drivers: ANSI and Unicode (both from the single installation package).
Default client encoding is being to be set depending on chosen one:
Win1250 for ANSI
UTF8 for Unicode

In both cases client encoding may be changed by executing SET NAMES or SET CLIENT_ENCODING command.
But putting either one or another into ConnOption string gives no expected results.