Setting environment variables for PostgreSQL

Fabio Tranchitella kobold at kobold.it
Mon Feb 19 15:48:54 CET 2007


Hi Andreas,

* 2007-02-19 15:23, Andreas Tille wrote:
> Hi,
> 
> when facing a font encoding problem during a migration from
> PostgreSQL 7.4 to 8.1 I found out that setting the client
> encoding explicitely via
> 
>      SET CLIENT_ENCODING='iso-8859-1';
> 
> solves this.  This can be enforced using an environment
> variable
> 
>      export PGCLIENTENCODING=LATIN1

I know that it is quite inelegant, but you could try to add the:

  export PGCLIENTENCODING=LATIN1

to the file:

  /var/lib/zope2.X/instance/$INSTANCE/bin/zopectl

> which works perfectly if I use psql as client.  So I tried
> both
> 
>    1. Adding
>          export PGCLIENTENCODING=LATIN1
>       on top of /etc/init.d/zope2.9 and

This should work, indeed. I'll investigate further...

>    2. adding
>          PGCLIENTENCODING=LATIN1
>       to /etc/default/zope2.9

This is not supported, as the default file is just used for a few
variables but the content is not exported.

> BTW, I tried to set the encoding directly in the
>      Z Psycopg Database Connection
> object, as 'LATIN1' without any success as well

This should work and it should be the right approach. What about psycopg2
and ZPsycopg2DA? Do they work for this use case?

Cheers,

-- 
Fabio Tranchitella                         http://www.kobold.it
Free Software Developer and Consultant     http://www.tranchitella.it
_____________________________________________________________________
1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564



More information about the pkg-zope-developers mailing list