When I am connecting to a telnet server using a socket I get all the garbage characters that you would not normally get using a telnet client. I was wondering how I can remove these characters from my final output. An example is:
I couldn't really find any concrete pattern to all those escape sequences (which I believe they are). I mean I know programmitically how to go about doing this but I just was wondering if there is an easier way to determine what is garbage and what is not.Code:______________________________________________________________________________←[ 004;001H_←[004;080H_←[005;001H_←[005;080H_←[006;001H_←[006;080H_←[007;001H_←[007 ;080H_←[008;001H_←[008;080H_←[009;001H_←[009;080H_←[010;001H_←[010;080H_←[011;00 1H_←[011;080H_←[012;001H_←[012;020H←[0m←[7m←(B Reports ......................... .... 1 ←[012;080H←[0m←(0_←[013;001H_←[013;021H←[0m←(BSetup←[013;027Hand←[013;031 HDefinitions←[013;043H...............←[013;059H2←[013;080H←[0m←(0_←[014;001H_←[0 14;021H←[0m←(BStatus←[014;028HMonitor←[014;036H......................←[014;059H3 ←[014;080H←[0m←(0_←[015;001H_←[015;080H_←[016;001H_←[016;080H_←[017;001H_←[017;0 80H_←[018;001H_←[018;080H_←[019;001H_←[019;080H_←[022;029H←[0m←(BPlease←[022;036 HEnter←[022;042HChoice←[022;049H:←[022;051H←[0m←[1m←(B1←[022;080H←[0m←(0_←[023;0 01H_____________________________________________________________________________
thanks