Skip to content
Advertisement

Apache Telnet Client does not recevie non-ASCII characters

I’ve been trying to useorg.apache.commons.net.telnet.TelnetClient and I am having trouble to receive non-ASCII characters (in my case polish chars like ą,ę,ć,ź and few others). The problem is not on server side – when I use default Ubuntu telnet implementation or Putty I have no problem receiving non-ASCII characters. My code looks something like this (simplified a bit for readability):

JavaScript

I used Wireshark to take a closer look. When using the Apache telnet client, packets do not contain non-ASCII characters at all, and while using default Ubuntu telnet they do contain them: Apache telnet Default ubuntu telnet

I’ve been wondering if the Apache client turns on some mode for the server to send only characters that can be encoded on 7 bits. I’ve tried several terminal types or to subnegotiate binary transmission but without success:

JavaScript

Advertisement

Answer

I’m not sure why sub negotiation does not work but I found a workaround.

Try to add SimpleOptionHandler with option 0 (BINARY) to TelnetConnection. It will cause that this option will be enabled from the start.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement