How to enable automatic switch of terminal encoding in ubuntu

Source: Internet
Author: User
The cause of automatic switch of terminal encoding in Ubuntu: Most of the bbs logon tools in ubuntu are not very good. For example, qterm. Using gnome-terminal directly to log on to bbs seems to be better. But bbs encoding is generally GBK, and my locale is UTF-8, so the need to convert. Entering telnet *** @ *** on the command line every time is very troublesome, and you need to manually change the encoding on the menu bar. So I hope there is a reason for changing the terminal encoding automatically under gnome-te Ubuntu under the command line:

Most of the bbs logon tools in ubuntu are in bad fonts. For example, qterm. Using gnome-terminal directly to log on to bbs seems to be better. But bbs encoding is generally GBK, and my locale is UTF-8, so the need to convert.

Entering telnet *** @ *** on the command line every time is very troublesome, and you need to manually change the encoding on the menu bar. So I want to have a method that can modify gnome-terminal encoding under the command line. Then write the command and telnet ssh into the. sh file, and you can double-click to run it.

Solution:

Use luit
Sudo apt-get install luit

Use the command line to log on to the bbs:
Luit-encoding gbk ssh username @ hostname

However, the following error occurs during luit execution in ubuntu:
Warning: couldn't find charset data for locale *****; using ISO 8859-1.

By reading man luit, we found that
FILES
/Usr/lib/X11/fonts/encodings. dir
The system-wide encodings directory.

/Usr/lib/X11/locale. alias
The file mapping locales to locale encodings.

The two files are located in ubuntu:
/Usr/share/X11/locale. alias
/Usr/share/X11/fonts/encodings. dir

Make a link to the preceding directory:
Ln-s/usr/share/X11/locale. alias/usr/lib/X11/locale/
Ln-s/usr/share/X11/fonts/encodings/encoding. dir/usr/lib/X11/fonts/encoding/

If the prompt file does not exist, you need to create the target directory structure.

In this way, you can use
Luit-encoding gbk ssh username @ hostname

To log on to bbs.

Save the command to the. sh file and double-click it to run it.

Note: It can finally be automatically converted to GBK. Several. sh files are made for different bbs and placed on the panel. However, by modifying the system font and modifying the qterm settings, we can see that the effect is still acceptable. Therefore, qterm is also used. However, luit can be used to log on to other hosts with different codes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.