Client encoding not the same as the db encoding

Started by Clodoaldoabout 14 years ago4 messagesgeneral
Jump to latest
#1Clodoaldo
clodoaldo.pinto.neto@gmail.com

In 9.1.3 the client encoding is not defaulting to the db encoding:

postgresql.conf:

#client_encoding = sql_ascii

=> show server_encoding;
server_encoding
-----------------
SQL_ASCII

=> show client_encoding;
client_encoding
-----------------
UTF8

In 9.0 the client encoding defaults to the db encoding:

postgresql.conf:

#client_encoding = sql_ascii

=> show client_encoding;
client_encoding
-----------------
SQL_ASCII

=> show server_encoding;
server_encoding
-----------------
SQL_ASCII

What am i missing? Regards, Clodoaldo

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Clodoaldo (#1)
Re: Client encoding not the same as the db encoding

On Wednesday, February 29, 2012 6:47:21 am Clodoaldo Neto wrote:

In 9.1.3 the client encoding is not defaulting to the db encoding:

postgresql.conf:

#client_encoding = sql_ascii

=> show server_encoding;
server_encoding
-----------------
SQL_ASCII

=> show client_encoding;
client_encoding
-----------------
UTF8

In 9.0 the client encoding defaults to the db encoding:

postgresql.conf:

#client_encoding = sql_ascii

=> show client_encoding;
client_encoding
-----------------
SQL_ASCII

=> show server_encoding;
server_encoding
-----------------
SQL_ASCII

What am i missing? Regards, Clodoaldo

My guess this:
http://www.postgresql.org/docs/9.1/interactive/release-9-1.html
"E.4.3.10.1. libpq

Add a libpq connection option client_encoding which behaves like
he PGCLIENTENCODING environment variable (Heikki Linnakangas)
The value auto sets the client encoding based on the operating
system locale.
"

Which leads to this:
http://www.postgresql.org/docs/9.1/interactive/libpq-connect.html#LIBPQ-CONNECT-CLIENT-ENCODING

--
Adrian Klaver
adrian.klaver@gmail.com

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Adrian Klaver (#2)
Re: Client encoding not the same as the db encoding

Adrian Klaver <adrian.klaver@gmail.com> writes:

On Wednesday, February 29, 2012 6:47:21 am Clodoaldo Neto wrote:

In 9.1.3 the client encoding is not defaulting to the db encoding:
What am i missing? Regards, Clodoaldo

My guess this:
http://www.postgresql.org/docs/9.1/interactive/release-9-1.html
"E.4.3.10.1. libpq

Add a libpq connection option client_encoding which behaves like
he PGCLIENTENCODING environment variable (Heikki Linnakangas)
The value auto sets the client encoding based on the operating
system locale.
"

No, probably more this (under "psql")

* Have psql set the client encoding from the operating system locale by default (Heikki Linnakangas)

This only happens if the PGCLIENTENCODING environment variable is not set.

I think the idea was to try to match your terminal window's encoding
automatically.

regards, tom lane

#4Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Tom Lane (#3)
Re: Client encoding not the same as the db encoding

On 02/29/2012 07:50 AM, Tom Lane wrote:

Adrian Klaver<adrian.klaver@gmail.com> writes:

On Wednesday, February 29, 2012 6:47:21 am Clodoaldo Neto wrote:

In 9.1.3 the client encoding is not defaulting to the db encoding:
What am i missing? Regards, Clodoaldo

My guess this:
http://www.postgresql.org/docs/9.1/interactive/release-9-1.html
"E.4.3.10.1. libpq

Add a libpq connection option client_encoding which behaves like
he PGCLIENTENCODING environment variable (Heikki Linnakangas)
The value auto sets the client encoding based on the operating
system locale.
"

No, probably more this (under "psql")

Well I was half way there:)
http://www.postgresql.org/docs/9.1/interactive/app-psql.html

"If at least one of standard input or standard output are a terminal,
then psql sets the client encoding to "auto", which will detect the
appropriate client encoding from the locale settings (LC_CTYPE
environment variable on Unix systems). If this doesn't work out as
expected, the client encoding can be overridden using the environment
variable PGCLIENTENCODING."

* Have psql set the client encoding from the operating system locale by default (Heikki Linnakangas)

This only happens if the PGCLIENTENCODING environment variable is not set.

I think the idea was to try to match your terminal window's encoding
automatically.

regards, tom lane

--
Adrian Klaver
adrian.klaver@gmail.com