Forum OpenACS Q&A: ADP pages UTF-8 configuration problem

I'm doing a fresh installation of AOLserver 4.5.0 (Tcl 8.5.2), but I'm having problems to configure UTF-8 encodings.

I need to use UTF-8 in all places of my site (including tcl, html and adp pages), and some of my AOLserver configurations params are (this parameters were sugested by others messages in this forum):

ns_section "ns/mimetypes"
ns_param default "*/*"
ns_param .adp "text/html; utf-8"
ns_param .html "text/html; utf-8"
ns_param .txt "text/plain; utf-8"

ns_section "ns/encodings"
ns_param adp "utf-8"
ns_param html "utf-8"

ns_section "ns/server/server1"
ns_param directoryfile "index.htm,index.html,index.adp"
ns_param pageroot $pageRoot
ns_param maxthreads 20
ns_param minthreads 5
ns_param maxconns 20
ns_param urlcharset "utf-8"
ns_param outputcharset "utf-8"
ns_param inputcharset "utf-8"

But this configurations works fine only for .html pages, and not for .adp pages. To demonstrate the problem, I configurate a test server with 2 identical files, one with html extension and one with adp extension. The only difference between the two pages is the extension. Please, look how que AOLserver handles the encoding of them in my test server:

http://www9.sms.org.br:8000/teste.html
http://www9.sms.org.br:8000/teste.adp

As you can see, the UTF-8 encoding is correctly used in the page with html extension, but not in the (identical) page with the adp extension.

Please, how can I configure this correctly?

Thanks!

Collapse
Posted by Emmanuelle Raffenne on
Hi,

The mimetype section params don't use the right syntax, it should be:

ns_section "ns/mimetypes"
ns_param default "*/*"
ns_param .adp "text/html; charset=utf-8"
ns_param .html "text/html; charset=utf-8"
ns_param .txt "text/plain; charset=utf-8"

Although, AFAIK, it's not necessary to explicitely set it for adp files, they are served using utf-8 as long as the defaultcharset and outputcharset are set to "utf-8".

On the other side, the urlcharset, inputcharset and ouputcharset usually are in the ns/parameters section. Here's what I have in mine:

ns_section ns/parameters
...
...
ns_param HackContentType 1
ns_param DefaultCharset utf-8
ns_param HttpOpenCharset utf-8
ns_param OutputCharset utf-8
ns_param URLCharset utf-8

Hope that will help.

Collapse
Posted by Abrantes Filho on
Hi Emmanuelle,

Thank you for your message. I did the syntax modifications and included the parameters sugested by you, but the problem continue.

Any other suggestion?

Thanks again!

Collapse
Posted by Emmanuelle Raffenne on
In the sample-config.tcl that comes with aolserver, extensions are preceded by a dot "." in the ns/encodings section:

ns_section ns/encodings
ns_param .adp "utf-8"
ns_param .html "utf-8"

maybe that's the reason (I don't use that section myself and get my adp files in utf-8 with no problem).

If it still fails after that, check again the encoding of your adp file just in case.

Collapse
Posted by Abrantes Filho on
Hi again Emmanuelle,

Thank you, thank you very much!!

That little "." saves the day!! Now the UTF-8 encoding for ADP pages are working fine!

But the example config file that comes with AOLserver 4.5.0 source (base.tcl) is wrong, because the example file do not use the "." in the extensions. In the example file:

# $Header: /cvsroot/aolserver/aolserver/examples/config/base.tcl,v 1.2 2005/08/24 14:00:18 shmooved Exp $
# $Name: aolserver_v45_r0 $
#
# base.tcl --
#
# A simple example of a Tcl based AOLserver configuration file.

[ ... ommited ... ]

ns_section "ns/encodings"
ns_param adp "iso8859-1"

[ ... ommited ... ]

So I just change the "iso8859-1" to "utf-8".

I'll point this to AOLserver developers.

Thanks again!!