Forum OpenACS Q&A: Still more on charsets

Collapse
10: Still more on charsets (response to 1)
Posted by Jonathan Marsden on
OK... more details on why .html files containing Latin-1 characters are served fine by AOLserver alone, but not by OpenACS 3.2.5. And a patch!

All the AOLserver internationalization features work, as long as content is sent to the client using ns_return and friends. Which it usually is.

However, when outputting .html files, OpenACS tries to 'optimize' things, and doesn't use ns_return at all. As a result, the internationalization features never kick in, and the Unicode TCL string containing the body of the .html file is not converted back to a more common charset at all.

Comments in the OpenACS TCL code (in ad-html.tcl and ad-utilities.tcl.preload) say this "saves a packet". Which it would... but apparently this is at the expense of messing up internationalization.

I have a small patch that seems to work (ie. after applying it, .html files containing Latin-1 chars are served so that the browser displays them correctly).

Downside: It sends the entire page at once, including any associated comments and links. This could mean a perceived delay for the end user, compared to the old way in which the body of the page was output before the comments and links were.

Overall, I prefer correctness to speed... but if someone else could look this over and show me the "better way" to get both the split display and the correct charset in the output, that would be great! My patch is now available as https://openacs.org/sdm/one-patch.tcl?patch_id=43 in the SDM.