Forum OpenACS Development: Re: Ain’t No ☀shine

9: Re: Ain’t No ☀shine (response to 8)
Posted by Stefan Sobernig on
Hi Michael!

Do you expect, that the HEAD version of NaviServer fixes the problems also with Tcl8.5?

If you make sure that you massage the value (Tcl_Obj) that you pass to/ receive from properly with [encoding convertto] and [encoding convertfrom], the examples that you showed will work whatever Tcl version you run. This is not some issue of some Tcl version you are looking at. It is a more general requirement when you turn Tcl (internal) values into an external value; and vice versa.

browser opens the request as a download/attachment file
This is a symptom of a subtle interaction of failing in complying with the above value protocol plus the way NaviServer (presumably post 4.99.11) sniffs on the value type. It is not related to Tcl. If one fails to comply with the above, will not be presented a broken string as an octet-stream (file download), but a broken string rendered by the browser. No win, just a shift.

So, in short (haven't checked but that is my understanding):

- use [encoding convertto] and [encoding convertfrom] in a disciplined manner when handling your values to an IO channel that does not run the transformation on its own (this is what you observe as the diff between -translation auto/binary, -translation binary implies -encoding binary, meaning don't touch the outgoing value).

- if you want to have the unexpected octet-stream go away in the responses on broken strings, you should update NaviServer, but you have to get the above right anyway. But emphasis is on the first item.

HTH, Stefan