Forum OpenACS Development: Re: Charset difference with NaviServer and OpenACS 5.9:
That said, ad_return_top_of_page uses ReturnHeaders that, in turn, uses ns_startcontent, which sets the connection outputEncoding (see Ns_ConnSetEncoding in conn.c). The default connection outputEncoding is suppose to be utf-8 anyway.
FWIW, the outputEncoding is utilized in Ns_ConnWriteVChars (in connio.c) to convert the response bytes using Tcl_UtfToExternalDString (if outputEncoding is not set to utf-8) i.e. converting each byte of a utf-8 character before it is sent to the browser.
the function used on this page (im_report_write_http_headers) is NOT using ReturnHeaders.
Thanks for the quick replies first of all.
I spent a few hours producing sample code and unsuccessfully trying to understand character encoding in AOL/NaviServer. Until I found out that I simply have to replace ns_startcontent with ReturnHeaders. Sorry, this didn't become clear from your discussion.
- Maybe you want to update the documentation of ns_headers. It does't say anything about "configuring the streams", which it should. I understood it's just a variant of ns_write.
- Why did't you update ns_startcontent to behave consistently in NaviServer?
Even following the SF discussion on ns_headers I don't understand why you had to break something, even if it is "old" or "inconsistent".
This is all handled automatically now, and ns_startcontent should not be used.
Breaking stuff means increased costs for us (and others) to update. If you break stuff, then we'll need to fall back to the policy to update only if absolutely necessary. The last time we managed to stay 7 years in that mode...
I have provided you with simple functions showing how streaming pages are supposed to work, using these should be quite straightforward for an experienced developer.
The function "ns_startcontent" was deprecated in NaviServer about 9 years ago, so i am not impressed by the the 7 years your code worked for aolserver :). The function was probably at no time working in NaviServer exactly as in aolserver (my guess is that the differences might be related with the various strange charset options in aolserver which are gone in NaviServer). It would have been probably better to remove the function in NaviServer 10 years ago, so the difference would have popped up sooner.
Anyhow, the right way for OpenACS applications is to use the abstractions provided by OpenACS and not using the low-level functions. These were introduced 15 years ago not without reason.
all the best