Forum OpenACS Q&A: Response to Support for multibyte: .tcl ok .adp not

Posted by Kenny Chiang on

I use the following shell script to start the aolserver:

LD_LIBRARY_PATH=/usr/local/pgsql/lib:usr/local/lib      export LD_LIBRARY_PATH
PGCLIENTENCODING=UNICODE                                export PGCLIENTENCODING
LANG=zh_TW.Big5                                         export LANG
umask 022
exec /home/nsadmin/bin/nsd $*

and set the environment as below in my profile to run psql:

PATH=$PATH:/usr/local/pgsql/bin:~/bin         export PATH
LANG=zh_TW.Big5                               export LANG

In this way you have nsd talks to the postgres in UNICODE and have psql speaks BIG5 (or in your case iso-8859-1). Since the data you POST thru aolserver is actually stored in postgres in UNICODE encoding and that is what you saw in the server log. OTH, if you want to query the db thru psql, then you have to set PGCLIENTENCODING to ISO8859_1 (I'm not sure if the spelling is correct, you have to check on postgres documents) to have the postgres client library to convert UNICODE to ISO8859-1, so you can display your charset correctly in your terminal.

-- Kenny Chiang