Re: client_encoding / postgresql strange behaviour

Поиск
Список
Период
Сортировка
Искать

Re: client_encoding / postgresql strange behaviour

От:
"Enrico Sabbadin" <sabbadin@mail.sabbasoft.com>
Дата:
>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 
>
>
>
>
>
>
>
> 
>                   
>
 







 
                   
FAQ