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.