Character encoding settings in Ubuntu

Source: Internet
Author: User


Ubuntu character encoding settings Ubuntu system by default only supports Chinese UTF-8 encoding, But we write some documents, as well as java code compilation using gbk encoding. So you need to modify it. Step 1: www.2cto.com: gedit/var/lib/locales/supported. d/local to modify/var/lib/locales/supported. d/local file. Add the following content to the file: zh_CN.GBK GBKzh_CN.GB2312 GB2312zh_CN. UTF-8 UTF-8 Step 2: sudo dpkg-reconfigure -- force locales force update settings. Step 3: Add or modify the red part in/etc/environment: PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin: /usr/bin:/sbin:/bin: /usr/games "export JAVA_HOME =/home/qujianfeng/java/jdk1.6.0 _ 37 export JRE_HOME =/home/qujianfeng/java/jdk1.6.0 _ 37/jreexport CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib after completing the preceding steps, restart the system. After www.2cto.com and above are completed, it is found that after tomcat is started, its jvm uses UTF-8 encoding, and some Chinese characters output in the program will be garbled. Therefore, you need to set jvm character encoding for tomcat startup: step 4: Go to tomcat/bin/catalina. add the red part to sh:

# OS specific support. $ var _ must _ be set to either true or false. cygwin = falseos400 = falsedarwin = false step 5: After tomcat is started, the background information is garbled and the terminal code is set to gbk:

Step 6: open Chinese garbled characters in gbk format in gedit. Solution: by default, garbled characters will appear when you use the Ubuntu Text Editor (gedit) to open Chinese-encoded text files of the GB18030, GBK, and GB2312 types. The reason for this is that gedit uses an encoding matching list. Only the encoding in this list matches the list, and the encoding not in this list is garbled. Add GB18030 to the matching list. Run: gsettings set org. gnome. gedit. preferences. encodings auto-detected "['utf-8', 'gb18030', 'gb2312', 'gbk', 'big5', 'current ', 'utf-16'] "OK, so all settings are complete.

Related Article

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.