displaying extended ASCII from a telnet session

Samuel Walters swalters_usenet at yahoo.com
Fri Jan 9 16:02:38 EST 2004


|Thus Spake Christian Wilcox On the now historical date of Fri, 09 Jan
2004 11:04:27 -0600|

> I'm trying to programmatically access information from a telnet session
> which is normally accessed with a telnet program capable of terminal
> emulation (currently set at VT320).  The initial login text displays
> fine, of course, but when I get to the section which displays extended
> ASCII characters, Telnet from telnetlib displays the following garbled
> mess:

<snip>
> Any ideas of a way to decode this information?

Tell us a bit more detail on your problem, such as what program/system are
you trying to get to access what program/system.

Unless you correct me, I'll assume that you're trying to get a python
program that may or may not be on a linux/unix computer to access a telnet
resource that you normally use a vt320 emulator to access.

The information you seek has to do with termcap, termio and (tangently)
curses.  Each terminal defines a set of codes and capabilities using a
termcap file (on *nix, at least.)  Those capabilities are stored in the
termcap database.  Your terminal program is not properly decoding these
codes and control sequences.  Specifically, the codes like ?[?40h are
control sequences.  and the long lines of q's are where the server
told the terminal to use line-drawing characters rather than normal
characters.  You, of course, only see q's because you aren't decoding the
stream.

Read up on the matter here:
http://www.gnu.org/software/termutils/manual/termcap-1.3/html_chapter/termcap_4.html#SEC23
and here:
http://www.gnu.org/software/termutils/manual/termcap-1.3/html_chapter/termcap_toc.html

But don't necessarily try to get a deep understanding of each element. 
Just try to get an overview so that you have a grasp on the issues
involved.  There are probably better manuals on this stuff, but these are
the definitive manuals.

Once you've done that and told us more about your problem, we'll be able
to have a much more informative discussion of how to resolve this issue.

HTH

Sam Walters.


-- 
Never forget the halloween documents.
http://www.opensource.org/halloween/
""" Where will Microsoft try to drag you today?
    Do you really want to go there?"""




More information about the Python-list mailing list