client_encoding / postgresql strange behaviour

From: "Enrico Sabbadin" <sabbadin(at)mail(dot)sabbasoft(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: client_encoding / postgresql strange behaviour
Date: 2008-09-16 11:15:41
Message-ID: 200809160515.AA82903154@mail.sabbasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>Hi, as far as I've understood client_encoding tells postgresql
>how data "will arrive / must be send back" to the client application.
>Postgresql will do the conversion for you if the database encoding is different.
>
>I've a unicode database and the line
>client_encoding=latin1 in the postgresql configuration file
>(this is the same as calling set client_encoding='latin1' on any connection right?).
>
>i insert one row containing the Hex 92 characther using the npgsql net driver :
>I sniff the wire and i see that that only the hex 92 bvbyte is sent.
>
>i insert one row containing the Hex 92 characther using the npgsql net driver
>setting Encoding=UNICODE in the cnstring:
>I sniff the wire and i see that that 3 bytes are sent : the coorect equivalent in unicode (i see that a set client_ecoeding=UNICODE is sent).
>
>Now i want to read the data using :
>1) if i read the first row keeping client_encoding latin1 everything is OK (i get hex 92 back)
>2) if i read the 2nd row setting client_encoding unicode everything is OK (i get the 3 unicode bytes)
>3) if i read the first row setting client_encoding unicode IT DOES NOT WORK I get a 2 byte sequence c2 92 ?? so i see garbage.
>
>WHY this does not work (can't i write in one encoding and read in another?)
>Looks like postgresql did not correctly converted from latin1 to unicode and has gargabage inside
>(but why do i read correctly the first line when i have client_encoding latin1) ?
>
>PLEASE help
>
>best regards
>Enrico Sabbadin
>
>
>
>
>
>
>
>
>
>



Responses

Browse pgsql-general by date

  From Date Subject
Next Message Glyn Astill 2008-09-16 12:34:44 Index order
Previous Message Jorge Godoy 2008-09-16 10:28:33 Re: foreign key problem