How can I input utf-8 symbols in telnet client on OS X?

0

1

I am using OSX 10.6.8 and telnet via terminal. I can input russian (utf8) symbols in terminal, but when i use telnet, i can see russian symbols, but cannot input them (instead of "тест" i get "Q^BP5Q^AQ^B" for example).

How can i fix that? Should I put something in ~/.telnetrc ?

DataGreed

Posted 2012-07-18T08:44:24.430

Reputation: 127

Answers

0

Telnet is used to connect to a shell-session on a remote host, you need to configure the remote hosts's shell to expect UTF-8. This is usually done by setting an environment variable ate the remote end. The exact details depend on the operating system and shell at the remote host. Here's one example:

export LANG=ru_RU.utf8

If the remote host is Linux, use locale -a inside the telnet session to get a list of supported values for this setting at the remote host.

RedGrittyBrick

Posted 2012-07-18T08:44:24.430

Reputation: 70 632

I already got export LANG=ru export LC_ALL=ru_RU.utf-8 in my ~/.bash_login - it allows me to input russian text in the terminal, but when i start telnet, input becomes broken – DataGreed – 2012-07-18T08:55:43.340

it seems to me like it has something to do with telnet encoding. In my question there is an example where i clearly input 4 utf8 symbols, but get 8 1-byte symbols. That's why my guess is that something should be in ~/.telnetrc – DataGreed – 2012-07-18T08:57:34.350

@DataGreed: try LANG=ru_RU.utf8 (I can't recall if LANG overrrides LC_ALL). You are doing this at the remote end, not the local end aren't you? – RedGrittyBrick – 2012-07-18T09:00:06.627

oh, i understood now. I am doing it on the local end. I have no access to configuring the remote server, but it supports UTF8 for sure. It returns text as utf, the problems start when i try to type smth in response – DataGreed – 2012-07-18T09:02:52.533

are you sure that typing one symbols and getting another is a remote issue? – DataGreed – 2012-07-18T09:03:51.113

@DataGreed: You can set LANG on the fly at the remote end just by typing (in ASCII) export LANG=ru_RU.utf8 inside the telnet session. You can also vi ~/.bashrc inside the telnet session to make this setting more permanent. The remote end is receiving multibyte UTF-8 characters, interpreting them as some single-byte encoding, finding some bytes are not printable characters and echoing them back using a notation that displays byte 0x02 as two ASCII characters "^B" (referring to Control+B often used on ASCII keyboards to transmit that byte value) – RedGrittyBrick – 2012-07-18T09:12:50.947

unfortunately i cannot do that, telnet server expects some other response from me and does not react to export LANG=ru_RU.utf8, it's something like a MUD game i believe – DataGreed – 2012-07-18T09:18:55.930

@DataGreed: You'll need to find out what encoding the MUD supports, you can then change your local encoding and input methods to match that. I'd guess a Russian MUD might support the KOI encoding rather than UTF-8 but I don't know anything about KOI. – RedGrittyBrick – 2012-07-18T09:25:19.463

The thing that it asks me for encoding at first, i select utf8 (tried on ultiple different servers), then i get readable symbols, but input is broken.. – DataGreed – 2012-07-18T09:28:08.913