Re: exec encoding



Hello,

Goeran Hanke wrote:
Hello,

the exec command returns the output of the program. Like this:

image create photo -data [exec import -window root gif:-]

The output of the program is binary data and the image is wrong. The
above command works if the format is xpm (7 bit ascii). I assume the
output of the command is converted to utf-8. The following snippet works
correctly:

set f [open "|import -window root gif:-" r]
fconfigure $f -translation binary
image create photo -data [read $f]
close $f

Is there any way to get the exec way work?
Something like "exec -translation binary ..."

Not yet. This is a known issue, and solution similar to the one you propose is discussed in TIP #259:
http://www.tcl.tk/cgi-bin/tct/tip/259.html

For now, your pipe method is, AFAIK, the only correct way to go.


Eric

-----
Eric Hassold
Evolane - http://www.evolane.com/
.



Relevant Pages

  • Re: wScript.Shell Problems
    ... the completion of the underlying process. ... However, the Exec procedure is ... Here is why i went to the RUN command, it is my understanding that the ... EXEC command does not allow for the BOOLEAN indicating wether the ...
    (microsoft.public.scripting.vbscript)
  • Re: Problem in calling c programs and compiling them in tcl/tk
    ... Are you using Tcl's glob command to do this? ... using exec gcc filename.c and later exec ./a.out filename.c. ... the execution of a command that might generate a Tcl error. ... i can call a c program and compile it? ...
    (comp.lang.tcl)
  • Re: xp_cmdshell default path (system32) problem
    ... exec xp_cmdshell @cmd1 ... - specify the full path in the del command ... ensure that xp_cmdshell ALWAYS executes under the security context of ... I haven't executed the actual erase statements yet but rather have been ...
    (microsoft.public.sqlserver.programming)
  • Re: Literal pipes in [open "|cmd..."]
    ... If it's not an [exec] directive, ... away with the intermediary pipe directives entirely also (or more ... As for a new command with a clean syntax, the only way you're going to ... fileevent $ou write $arg ...
    (comp.lang.tcl)
  • Re: Expect scripting
    ... I reverted to what I am familiar with which is script and used exec ... COMPL is the exact prompt from the remote processor? ... If the command were to be entered to the telnet session to this ... I strongly recommend you read.- Hide quoted text - ...
    (comp.lang.tcl)