By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,509 Members | 1,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,509 IT Pros & Developers. It's quick & easy.

displaying extended ASCII from a telnet session

P: n/a
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:

?[?40h?[?3l?[0;1m?>?[?1l?[?25l?[?3l?[0;0H?[2J?[?25l?(B??[0;7m?[23B ba6.0 version 03-1993/R1 ?[0m?[0;
7m?[1;2Hmtccom00000000?[1C ?[1C ?[1C ?[1C ?[
0m?[10;5H?(0?lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqk?[11;5Hx?[68Cx?[1
2;5Hx?(B? License Code : 178241/105?[39C?(0?x?[13;5Hx?(B? Developed for:?[52C?(0?x?[14;5Hx?(B?
Electronic Theatre Controls?[39C?(0?x?[15;5Hx?[68Cx?[16;5Hmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
x?(B??[60CChoice:s?[56C?(0?x?[1D?[1B(0?x?[1D?[1B ?[5C?(0?x?[1D?[1B

Any ideas of a way to decode this information?

Christian

Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
|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/termutil...p_4.html#SEC23
and here:
http://www.gnu.org/software/termutil...rmcap_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?"""

Jul 18 '05 #2

P: n/a

"Christian Wilcox" <cw*****@etcconnect.com> wrote in message
news:ma**************************************@pyth on.org...
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:

There may or may not be any 'extended' chars, but there are 'undisplayable'
chars, signaled by most of the '?'s (although a few might be real).
The '?' before '[' is the Escape char (what the Esc key on upper left
generates.). What follows are VTxxx escape sequences, which often start
with <esc>[.
?[?40h?[?3l?[0;1m?>?[?1l?[?25l?[?3l?[0;0H?[2J?[?25l?(B??[0;7m?[23B ba6.0 version 03-1993/R1 ?[0m?[0;
......Any ideas of a way to decode this information?


Since the escape sequences are about visual formating and not about
content, you probably do not need to as long as you can recognize and
discard what for you may really be noise. To make it easier, you might be
able to the the system that you are a really dumb pre-VT100 terminal that
only understands control chars and not the newer (as of about 2 decades
ago) control sequences. On *nix, this might just mean resetting the TERM
environment variable. But some programs might only talk to clients that
are VT100 capable.

Another route entirely. Terminal and telnet programs often have a script
capability with commands like "when you receive 'sometext', send 'mytext'"
and others to turn saving to a disk file on and off.

Or, if you can install programs on the target, perhaps you can get at the
info directly withoug virtual screen scraping and just email yourself a
file in the format you want.

Terry J. Reedy
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.