English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
In the Linux system, the content of the file name is urf8Encoding, in the Windows system, the default file name encoding is gbk, most documents use gbk encoding, and the system uses utf8Encoding
Garbled characters caused by the lack of Chinese input method
1、ibus input method
After installing the Ubuntu system, ibus input method is already included by default and does not start in English environment. To configure ibus to start automatically, you can select System in the Ubuntu system menu --- At this time, you still need to add ibus --- Add a program in the Startup Applications window:
Name: ibus-daemon Command: ibus-daemon -d -x -r
The Chinese input method provided by ibus by default is quite primitive and needs to be installed separately.-pinyin, the command is as follows:
sudo apt-get install ibus-pinyin
get install ibus-pinyin --- At this time, you still need to add ibus --- pinyin input method starts. On the Ubuntu system menu, select System + Preferences
2IBus Preferences, in the 'Select an input method' dropdown box on the Input Method page, select 'Chinese – Pinyin' to add, which is the one with a big 'Pin' character in the icon, then click the Add button, and finally move the input method to the top through the Up button. After the system restarts, use Ctrl
Space can be used to call out the ibus input method. Overall, the ibus input method is good, but in my environment, I found that it cannot be called out in some Java programs, such as Netbeans, OpenProj.
, fcitx input method
sudo apt-Log out and log in again, and fcitx will display normally.
Due to the defects of ibus, I tried fcitx, and it is also very good to use. It can also be used normally in Java programs. However, in this case, there is a problem with the cursor following, and the input interface will stop at the bottom of the screen, but it can be accepted. It is much better than ibus not being able to use it.
Install fcitx:-s fcitx -Start fcitx:
im-s fcitx -Log out and log in again, and fcitx will take effect. If you need to switch back to ibus, you can run im + switch/config, this file is GBK encoded and does not display normally in Ubuntu. You can operate in the following way:/s ibus, then log out and log in again. fcitx can also be activated through Ctrl
Empty out the style, at this time, you will find that the Chinese displayed by fcitx is a box, so you need to modify the fcitx configuration. The fcitx configuration file is in ~/config, this file is GBK encoded and does not display normally in Ubuntu. You can operate in the following way: iconv -f gbk -t utf8 cd ~
.fcitx
config > config.tmp
Edit the config.tmp file:10
Display font (Chinese) = WenQuanYi Micro Hei
Display font size =
iconv -f utf8 -Use bold = 0
Save and exit, and then run the command:
t gbk config.tmp > config
sudo apt-Log out and log in again, and fcitx will display normally.-For the problem of Chinese character garbled in the candidate words of the Sogou input method, first run-get install fcitx
module
utf8 kimpanel-8 Then log out or restart, generally it is okay
and UTF-8What is the difference-8is the standard writing method. In Windows, the English does not distinguish between uppercase and lowercase, so it can also be written as 'utf'.-8It can also omit the middle ''. UTF-Omitting, written as 'UTF'.8Generally, programs can recognize this, but there are exceptions (as mentioned below). To be more precise, it is best to use the standard uppercase 'UTF'.-8”Only in MySQL can use “utf-8”alias “utf8”But use uppercase “UTF”-8”
Solution to display Chinese characters as boxes in Flash on web pages
Edit/etc/fonts/conf.d/49-Modify the sansserif.conf file as follows:
<edit name="family" mode="append_last"> <string>WenQuanYi Micro Hei</string> </edit>
Solution to display Chinese characters as boxes in Java programs
In $JAVA_HOME/jre /lib/Create a fallback directory under the fonts directory, and copy (or link) the Chinese font file to the fallback directory.
sudo mkdir $JAVA_HOME/jre/lib/fonts/fallback sudo ln /usr/share/fonts/truetype/wqy/wqy-microhei.ttc $JAVA_HOME/jre/lib/fonts/fallback/
“GBK garbled characters”, for reference
The appearance of garbled characters is similar to:
à??ü òá??à3;?£???1,°2à??ü òá??à3;?£???1
Solution:
convmv -r -f utf8 -t iso88591 --notest --nosmart * && convmv -r -f gbk -t utf8 --notest --nosmart * # Copy the garbled filename file to an empty directory and run (even if it is wrong, it is not a problem):
“ASCII garbled characters”for reference
The appearance of garbled characters is similar to:
%E5%8C%BB%E4%BF%9D
Solution:
1.Use uni2ascii code: echo garbled original text | ascii2uni -a J
2.Install nautilus-filename-repairer0.06(The official has source code, but there is a dependency issue, I haven't installed it successfully, and 0.05Version has a slight cooperation obstacle with the current nautilus, can only be viewed and cannot be renamed)
3.Use chromeplus-1.3.3.1Download (because this kind of garbled character mainly occurs when using ff (default utf8)After downloading the file from the QQ group, it occurs, and there is no problem with chromeplus (default GBK)):
In addition, for the issue of garbled characters in the file content, you can search enca.
Solve Rhythmox garbled character issue:
Install Rhythmox: sudo apt-get install rhythmbox
install mid3iconv: sudo apt-get install python-mutagen
mid3iconv -h
Clementine garbled character issue
install mid3iconv: sudo apt-get install python-mutagen
mid3iconv -h
Clementine does not support utf8, need to convert all mp3The song is converted to GBK format, WMA seems not to need conversion
mid3iconv -e gbk *.mp3(Since it cannot be-r parameter, so you need to enter each folder in turn)
In addition, Clementine uses gstreamer as the backend, and you need to install gstreamer plugins:
If you want to support mp3, you need to install gstreamer-0.10-plugins-bad and gstreamer-0.10-plugins-ugly
If you want to support wma, you need to install gstreamer-0.10-ffmpeg
If you want to support mms streaming media, you need to install gstreamer plugins for mms
In addition, Clementine is based on Amarok, so most plugins for Amarok are also supported by Clementine, such as osdlyrics.
Convert file content encoding:
file -i <file name> detect file encoding iconv --help
Convert file name encoding
sudo apt-get install convmv convmv --help convmv -f gbk -t utf8 -r --notest files convmv -r -f utf8 -t iso88591 * --notest --nosmart && convmv -r -f gbk -t utf8 * --notest --nosmart
Solve gedit garbled characters problem:
gsettings set org.gnome.gedit.preferences.encodings auto-detected "['GB180302312', 'GBK', 'UTF-8', 'BIG5', 'CURRENT', 'UTF-16']"
gsettings set org.gnome.gedit.preferences.encodings shown-in-menu "['GB180302312', 'GBK', 'UTF-8', 'BIG5', 'CURRENT', 'UTF-16']"
Solve PDF Chinese garbled characters:
sudo apt-get install poppler-data
Solve the garbled characters of rar files
Use rar
Unzip zip file with garbled characters
Recently encountered this problem, searched on the Internet, and found that it is all about unzip -O, they are completely useless, these guys probably copied them directly and haven't used them at all. Later, I found a ultimate method, using Python scripts to unzip, and it really works!!! The following is the code of the Python script, create a file jieya.py and write the following code:
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import zipfile print "Processing File" + sys.argv[1] file=zipfile.ZipFile(sys.argv[1],"r"); for name in file.namelist(): utf8name=name.decode('gbk') print "Extracting " + utf8name pathname = os.path.dirname(utf8name) if not os.path.exists(pathname) and pathname!= "": os.makedirs(pathname) data = file.read(name) if not os.path.exists(utf8name): fo = open(utf8name, "w") fo.write(data) fo.close file.close()
Then put the zip file and jieya.py in the same directory, run the command python jieya.py file.zip, done!
Solution to smplayer Chinese subtitle garbled characters
Open Options -> Preferences: Select the Subtitle tab.
Find the 'Default Character Encoding' option and select 'Simplified Chinese (cp936)
Then open the 'Font' tab (at the top), select 'System Font' and choose a Simplified Chinese font from the drop-down list, such as Weu Quanyi Zen Hei, etc.
VLC player displays file name with garbled characters
Modify a Chinese font in the initial options
This is a summary of the solutions to the Linux code problem introduced by the editor, hoping it will be helpful to everyone. If you have any questions, please leave a message, and the editor will reply to everyone in time. At the same time, I would also like to express my sincere gratitude to everyone for their support of the Naoan tutorial website!