Hello,

I'm having a slight problem using non-Unicode charsets in
Tcl/AOLServer.  It seems that cannot get non-Unicode data from my
database and use this data with any functions other than ns_return and
ns_write.


Simplified flow of control:

1. read Shift-JIS data from the database into a Tcl var, "data"

the following all produce garbled output:
- send $data to a random address using "ns_sendmail"
- write $data to a file using a "shiftjis" configured filehandle
- write $data to a file using a "binary" configured filehandle

however, the following produces perfectly readable output:
- send $data to the browser using "ns_return 200 text/plain"
- send $data to the browser using "ns_write"


Interestingly enough, if we use the *exact same* handler code, but
replace step 1 as follows:

1a.  read Unicode data from the database into a Tcl var "data"
1b.  set data [ encoding convertto shiftjis $data ]

...then ALL of the examples listed above work.


Does anybody know why ns_write and ns_return would work in the first
example, while the file writes etc. produced mangled output?  Do either
of these functions do some kind of silent conversion, even when called
without a charset in the content-type tag?

And, equally bizarre, does anybody know why the same example works in
all cases simply by using Unicode data and performing a Unicode ->
Shift-JIS conversoin in the script?  Shouldn't this have the same
effect as fetching Shift-JIS data from the database?

(I did test this with a few other charsets, including Korean and
iso-2022-jp; same results).

any help would be much appreciated,
thomas park





__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

Reply via email to