Mark,

Hard to say what you are actually trying to do, but UTF-8 is a byte
array, if you want to call it that. The problem you are seeing may be in
displaying what the bytes are (which might not work for binary data, try
cat'ing a binary file and watch the fireworks.)

tom jackson


On Thu, 2008-08-28 at 18:50 +1000, Mark Aufflick 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);
> 
> or
> 
>             objPtr = Tcl_NewObj();
>             Tcl_AppendToObj(objPtr, str, length);
> 
> or
> 
>             objPtr = Tcl_NewStringObj(str, length);
> 
> etc.
> 
> this is then set as the result object, and control returns to the tcl
> code. 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.
> 
> 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?
> 
> Any help appreciated - this is driving me nuts :)
> 
> 


--
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.

Reply via email to