What you're getting back is the raw data including terminal emulation escape sequences. To get plain text, telnet to the account and modify your $term setting. You may want something simple like "tty". Exactly how you set this environment variable will vary depending on what shell you use. E.g., on my Solaris 8 unix box (running tcsh, similar to csh), I would issue the command: set term=tty
Note that if you do this (you might even want to change your shell initialization file permanently to reflect this) you may have to go back and twiddle with your expected prompt string. Also, instead of using terminal type "tty", you may want to set it to be the same or compatible with the telnet client you are using.