Re: why expect make the Chinese code garbled



On Jul 31, 8:59 pm, cla...@xxxxxxxxx (Cameron Laird) wrote:
In article <1c88d931-09a3-4963-95d0-36f56db18...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>,

Jason  <luoyuh...@xxxxxxxxx> wrote:
Hi all,

I use expect scripts in gnome-terminal to login a bbs

=============================
#!/usr/bin/expect
set user [lindex $argv 0]
spawn ssh $user@asite

interact timeout 160 {send "jk"}
exit
============================

The bbs site is Chinese character, if I just use ssh command, Chinese
character is readable, but if I use expect scripts,  it make Chinese
character garbled. I read the expect manual page, there is no anything
about charset. what can I do?

                        .
                        .
                        .
I it were mine, my next step would be to use autoexpect <URL:http://wiki.tcl.tk/autoexpect>, and see what I learn from that.

thanks! the reason is the environment variable, if I use
LC_ALL=zh_CN.GB18030 ./myscripts
it works.
I don't know how to set it in expect scripts, I use
set env(LC_ALL) zh_CN.GB18030
it didn't work.
.



Relevant Pages

  • Re: speed of script execution
    ... the execution of the following scripts. ... Of course "don't use the curly braces" but this is part of a larger ...
    (comp.protocols.kermit.misc)
  • RE: /etc/init.d/ - add/remove services
    ... leave the links alone and just manipulate the scripts ... the "no" in the filename whereas with the "exit" you'd have to look in the ... control over the runlevels. ...
    (Debian-User)
  • The best scripts ever (trick or treat)
    ... POST YOUR COOLEST SCRIPTS! ... prints an optional argument to stderr and exits. ... # but may not exit with a code other than 0. ...
    (freebsd-questions)
  • Re: How to shrink image files?
    ... I use the netpbm tools and some helper scripts, ... sub usage { ... my $exit = shift; ...
    (comp.os.linux.misc)
  • Re: what is the difference?
    ... > Could somebody tell me what the difference between these 2 scripts are? ... > exit 1 ... define $status to the the value of the last command executed. ...
    (comp.unix.shell)