Forum OpenACS Q&A: Problems with ISO-8859-1 character set (Bis, ter,...reptitas)

Despite all the steps taken I still can't get the data correctly with the accents. AolServer seems to be stubbornly UTF

Any help is appreciated

Oracle version 8.1.7
OACS version 4.5
Aolserver 3.3.1+ad13

The Oracle database was created with US7ASCII character set. As such the accents were stored in utf format by AolServer/tcl, and they worked correctly.

1 - Changed the character set of the ILO by executing the following:

SVRMGRL
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE CHARACTER SET WE8ISO8859P1;
ALTER DATABASE NATIONAL CHARACTER SET WE8ISO8859P1;
SHUTDOWN IMMEDIATE;
STARTUP;

Set up env. variable in .bash_profile

export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1

After this step sqlplus enters the accents correctly and shows them up correctly in select statement.

2 - Changed nsd.tcl in /usr/local/aolserver

nssection ns/parameters
ns_param  HackContentType    true
ns_param  URLCharset        iso-8859-1
ns_param  OutputCharset      iso-8859-1
ns_param  HttpOpenCharset    iso-8859-1

nssection ns/mimetypes
ns_param        ".htm"    "text/html; charset=iso-8859-1"
ns_param        ".adp"    "text/html; charset=iso-8859-1"
ns_param        ".txt"    "text/html; charset=iso-8859-1"
ns_param        ".tcl"    "text/html; charset=iso-8859-1"

3 - Changed init.tcl in /user/local/aolserver/modules/tcl

encoding system [ns_config ns/server/[ns_info server] SystemEncoding iso-8859-1]

4 - Changed form.tcl in /user/local/aolserver/modules/tcl

Change the following line
From
ns_set put $form $name $value

To
ns_set put $form $name [encoding convertfrom iso-8859-1 $value]

Do you really want the database in ISO-8859-1 encoding instead of UTF-8? The latter is recommended throughout for OpenACS use and gives you a lot more flexibility, especially should you ever have users that use other character sets than iso-8859-1.

Also I wonder if this:

export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1

is a good idea. According to these excellent installation instructions: http://archive.greenpeace.org/~bruno/oracle.html it breaks the date formatting. You might want to try to change it to export NLS_LANG=.WE8ISO8859P1 and make sure that it really affects the nsd process. E.g. try starting aolserver from the commandline like this:

$ NLS_LANG=.WE8ISO8859P1 nsd -f -t yourconfig.tcl ...

And of course when testing a new configuration always try to insert _and_ read the newly inserted data after the restart. Don't rely on already existing data, it might be wrongly encoded.