KpyM Telnet/SSH Server - Forum
ANSI escape codes don't work
AlanCF ANSI escape codes don't work
I am writing a program in python that displays the Star Wars asciimation (l0c41:// over telnet, and I am trying to use the KpyM telnet server as the telnet server. The way I display each frame of the asciimation is I use "\x1b[H" to go to 0,0 in the terminal, and write out the next frame. This dosn't work. Instead of jumping the cursor to 0,0 , it just displays ">[H". I have the asciimation running under telnetd(inetd) on a FreeBSD box (, but I want to use the KPYM server because it will automatically log on a user, and run my script. But the ANSI escape codes don't work. I also tested this script on the built-in Windows telnet server, and it worked, so something about the KpyM server won't let the ANSI escape codes work, I guess.

Please help!

Thanks in advance,

Kroum Grigorov
> I use "\x1b[H" to go to 0,0 in the terminal, and write out the next frame. This dosn't work

This will not work, unlike the *NIX terminals the windows console does not interpret the esc codes that you write. KTS will "try" to send to the client exactly the same screen that is displayed on the host computer. This means that if you run your app and it dumps esc secuances that are not interpreted by the windows console KTS will send the same garbage to the client escaping your esc secunaces so that they look the same way(or as close as possible) as in the windows console.

The "right" way to do your animation in KTS would be to use the native windows console functions to move the cursor and draw your frames and the native windows color functions to paint the frame in colors. KTS itself will generate the right esc sequances when you start your app inside the KTS session.


I use pipe_mode=1 in kts.ini and all the ANSI escape sequences work fine!


Kroum Grigorov
Yes, the pipe_mode=1 will run KTS a lot more like a *NIX daemon, but it comes with some limitations. You can't run console graphic applications like "" for example. This mode is mainly to be used with remote automation scripts, but it might work in your case too.



© 2007 - 2008 Kroum Grigorov
Powered by phpBB © 2001, 2005 phpBB Group