Hi Stephen, What does ns_conn write_encoded false do (although it is somewhat self explanatory)?
Also ns_startcontent is neat - saves me manually fudging the header with ns_write. On Fri, Aug 29, 2008 at 5:52 AM, Stephen Deasey <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 9:50 AM, Mark Aufflick > <[EMAIL PROTECTED]> wrote: >> Hi all, >> >> If I Ns_Log() the data in a (char *) I can clearly see that it >> contains newlines, and I can also verify that it contains nulls with >> memchr. >> >> I have tried any number of ways to turn it into a tcl object, eg: >> >> objPtr = Tcl_NewByteArrayObj(str, length); > > > This is the right way to do it. > > >> Whether the tcl code then does an ns_log, ns_return (which I >> know isn't supposed to be binary safe) or ns_write, i get all the >> newlines converted into \n (ie. two characters \ then n) and chunks of >> binary get converted to unicode characters. > > > In AOLserver 4.5, ns_write is the only command that accepts a binary data. > > You also need to be careful you don't accidentally change it's type > once you've created it. > > set blob [myblobcmd] > set length [string length $blob] > # blob now garbled utf8 :-( > > >> I can see from Tcl_AppendToObj that that is supposed to happen there, >> but how can I output a byte array object without it being converted to >> utf8? > > > Something like... > > ns_startcontent -type application/octet-stream > ns_conn write_encoded false > ns_write $blob > > > -- > AOLserver - http://www.aolserver.com/ > > To Remove yourself from this list, simply send an email to <[EMAIL > PROTECTED]> with the > body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: > field of your email blank. > -- Mark Aufflick contact info at http://mark.aufflick.com/about/contact -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.