Question

am trying to find a way to instruct ODBC drivers - Datadirect ODBC to use win1251 for client session.

There are for ways mentioned in USer Guide:

  1. Using the \encoding command in psql, which allows you to change client encoding on the fly.
  2. Using SET client_encoding TO: => SET CLIENT_ENCODING TO 'value';
  3. Using the PGCLIENTENCODING environment variable.
  4. Setting the configuration parameter client_encoding in the postgresql.conf file

But as far as i understand options 1 and 3 in not suitable for ODBC drivers, option 2 I am also could not use - because i use SAS and this engine doesn't allow me to execute manually edited SQL's - it use a lot of automatic codegeneration.

I have tried option client_encoding in postgresql.conf file, moreover I have tired to execute follow clommand in psql admin session: alter user sasuser SET client_encoding to WIN1251; but nothing changes - by default client encoding is still UTF8...

currently in Datadirect ODBC.ini file i have follow string:

IANAAppCodePage=2251

Could somebody help me please?

Was it helpful?

Solution

This should definitely do the trick:

ALTER USER sasuser SET client_encoding TO WIN1251;

Only remaining explanations can be:

  • You are in fact connecting to the DB with a different user.
  • At some point during the connection client_encoding is explicitly set to another value.
  • You are connecting to the wrong database cluster (same IP? same port?)

To find out, set log_statements = all, make the server cluster reload, start a session with your user-unfriendly tool, and check the database log, if and what was actually communicated to the server. Don't forget to reset log_statements or your log files will grow huge.


Or it is all just a typo in Datadirect ODBC.ini:

IANAAppCodePage=2251

That supposed to be 1251?

Nope. IANAAppCodePage MIBenum 2251 stands for "WINDOWS_1251". That's not it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top