I did try opening a pipe at one point (I tried a lot of different
things last night) but I can't remember if that was before or after I
found fconfigure.
I did find that it does not seem to be possible to open a pipe for
both reading and writing. I tried it and was able to write data to
the pipe (simulating stdin) but my read from the same channel just
hung. Reading from the channel does work if it is opened only for
reading.
The combination of an open pipe with fconfigure would allow me to
send data to the command properly, but I'd still have to use a file
to get the output. Still 50% less files is a good thing! :)
However, Dossy's suggestion of using the encoding command is very
intriguing - I've looked at that page of Tcl commands hundreds of
times and never noticed it. If it does what I need, that will be a
much better solution.
Thanks to both of you!
janine
On Sep 5, 2007, at 12:59 AM, Bas Scheffers wrote:
Instead of using exec, have you tried to open a pipe (open "|
javacmd") and use fconfigure on the I/O channel returned by this?
Cheers,
Bas.
On 5 Sep 2007, at 17:05, Janine Sisk wrote:
This may be more of a Tcl question than an AOLserver one, but I'm
guessing that people on this list are more likely to have run into
it. So here goes.
I'm working with strings encoded in big5 and gb2312 (traditional
and simplified Chinese, respectively). I'm exec'ing out to an
Java program that translates from one to the other. I have found
that the only way to get my data to the program intact, and get
the response back intact, is to store the data in intermediate
files with the fconfigure command to set the encoding. Anything
else ends up mangling the data. I can't, for example, grab the
return value of the command directly from the exec; if I do, it's
mangled. I have to have the java program write it to a file, and
then read it with the encoding set, in order to get the data intact.
As you can imagine, having to write two files per page request
isn't exactly ideal, even with caching. So has anyone else done
this and found a way to do it?
thanks,
janine
--
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.
--
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.
--
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.