I am using SSHTools / J2SSH to connect to a server via SSH. Everything works fine, only problem is, that the output contains strange escape sequences / characters. I read somewhere, that these are color codes and that it is not an encoding issue.
Now my question is: How do I get rid of them? Seems like I need some sort of Terminal Emulation, which interprets or strips off these codes.
Here is the output of ls
:
[0m[01;34msketchbook[0m sketchbook.tar sketchbook.tar.tar [01;32msshsudo[0m [01;34mtmp[0m tmp.tar
(Note: There are other commands I need to call, so ls --color=never
won’t do the job.)
I tried the library Jsch before, there you can use ((ChannelShell)channel).setPty(false);
to get rid of these characters, but I did not find something similar for SSHTools.