Reputation: 735
I'm using telnetlib to connect to a remote telnet server and parse it's response, however, all telnetlib's read_*
methods return its raw response - including raw telnet command bytes (starting with 0xFF) - which is undesirable for my purpose.
For example, when calling read_all
:
desired output - b'Hello'
output returned by telnetlib - b'\xff\xfd\x18\xff\xfdHello'
Is there a way to make telnetlib exclude those special telnet control bytes from its output?
Upvotes: 0
Views: 621
Reputation: 303
As far as I can tell from your question you need to convert the string into UTF-8. This may be your solution. https://www.tutorialspoint.com/python/string_decode.htm
Upvotes: -1