Hi,
maybe you can give me a hint whats going on...
Background: My app uses a registered filter and proc to handle requests to
files. ADP files (UTF-8) are ns_adp_parse'd (including data from database,
UTF-8) and ns_returned (w/o -binary). I don't do any mapping of ADP files via
config, additionally I have ns_unregister_adp calls on GET, HEAD, POST.
My default config says:
--------------------------------------------
section ns/encodings
.adp: utf-8
.html: utf-8
section ns/mimetypes
.adp: text/html; charset=utf-8
.html: text/html; charset=utf-8
section ns/parameters
outputcharset: utf-8
urlcharset: utf-8
preferredcharsets: utf-8
--------------------------------------------
This szenario works.
Now, if I want to automatically change the
output encoding from utf-8 to let's say iso-8859-15,
I try to do it like this:
--------------------------------------------
section ns/parameters
outputcharset: iso8859-15
section ns/mimetypes
.adp: text/html; charset=iso-8859-15
.html: text/html; charset=iso-8859-15
--------------------------------------------
In my test case, 'string length' on the parsed adp string
gives me 7109 bytes, 'string bytelength' 7147 bytes,
in the Header 'Content-Length' is 7147 and wget stops
after byte 7109 (e.g. Opera requests the page twice, haha,
I lost one day to figure out why):
string length: 7109 bytes = bytes returned
string bytelength: 7147 = Content-Length header
If I now 'ns_return -binary' those 7109-Tcl-ByteArray-Bytes
and request them (7109bytes + Content-length 7109) via wget
(that works now, and Opera is happy again),
I can
recode iso-8859-15..utf-8 testpage.html
("hey, recode, assume it's iso, transform it to utf-8")
but not
recode utf8..iso-8859-15 testpage.html.
(the testpage.html is created from the parsed adp).
I agree, I'm confused. Where to look for the bug? In my
configuration/app or in the server? Of course, using -binary switch is not the
proper solution.
Thanks!
Bernd.