Re: BUG #2319: psql utf8/latin1 client_encoding bug when using '-c' - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2319: psql utf8/latin1 client_encoding bug when using '-c'
Date
Msg-id 10905.1142470588@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2319: psql utf8/latin1 client_encoding bug when using '-c'  ("Mattias Kregert" <mattias@kregert.se>)
List pgsql-bugs
"Mattias Kregert" <mattias@kregert.se> writes:
> -- ...but this does not.
> % psql -h server mydb -c "set client_encoding to 'latin1'; select * from
> mytable where text='ÅÄÖ';"
> ERROR:  invalid UTF-8 byte sequence detected near byte 0xc5

There is no hope of that ever working, since the string will be read (and
converted to the server's encoding if relevant) before the SET is
executed.  Better find another way to do what you want.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2315: Crash engine after modify "active" function
Next
From: Tom Lane
Date:
Subject: Re: BUG #2317: Wrong sorting order for (VW)