Solution summary of the garbled code problem under Linux

  • 2020-05-13 04:13:53
  • OfStack

The content of the file name in linux system is urf8, and the file name in windows system is gbk by default. Most documents are gbk, and the system adopts utf8

No Chinese input method caused by garbled code

1. ibus input method

Ubuntu system has been installed with ibus input method, which is not started by default in English environment. To configure ibus automatic startup, you can select System -- Preferences -- Startup Applications from the ubuntu system menu, and add one program to this window:


Name: ibus-daemon
Command: ibus-daemon -d -x -r

The default Chinese input method provided by ibus is relatively weak, so it is necessary to install ibus-pinyin. The following commands are given:


sudo apt-get install ibus-pinyin

At this point, the ibus-pinyin input method also needs to be started. Select System -- Preferences -- IBus Preferences from the ubuntu system menu. In the "Select an input method" drop-down box on Input Method, select add Chinese, Pinyin, which is the one with a big "spout" in the icon. Then click the Add button and move the input method to the top by Up button. After system restart, Ctrl + space can be used to call out the ibus input method. The ibus input method is generally good, but I found that I could not call it in some Java programs in my environment, such as Netbeans and OpenProj.

2. fcitx input method

Due to the defect of ibus, I tried fcitx, which is also very good, and can be used normally in Java program. However, there are some problems with the cursor following in this case, and the input interface will stop at the bottom of the screen. However, it is acceptable, which is much better than not being able to use ibus.

Install fcitx:


sudo apt-get install fcitx

Start the fcitx:


im-switch -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-s ibus, log out, and log in again. fcitx can also be called out through Ctrl + space. You will find that fcitx shows a box in Chinese, so you need to modify the configuration of fcitx. The configuration file of Fcitx is in ~/.fcitx /config, which is the code of GBK. It is not displayed normally under Ubuntu, so it can be operated in the following way:


cd ~/.fcitx
iconv -f gbk -t utf8 config > config.tmp

Edit config.tmp file:

Display font (middle)=WenQuanYi Micro Hei

Display font size =10

Use bold =0

Save exit, and then run the command:


iconv -f utf8 -t gbk config.tmp > config

Log in again after logout, fcitx shows normal.

For the sogou input candidate word garbled problem, run first


sudo apt-get install fcitx-module-kimpanel

Then log off or restart, 1 will do

What is the difference between utf8 and UTF-8

"UTF-8" is the standard. It is case insensitive under windows, so it can also be written "utf-8". "UTF-8" can also be written "UTF8" by omitting the middle "-". All applications are recognized, but there are exceptions (see below). To be strict with 1, it is best to use the standard uppercase "UTF-8". The alias "utf-8" can only be used in MySQL, "utf8", but elsewhere the first law is capitalized "UTF-8".

The Chinese version of Flash on the web page is shown as the solution to the box

Edit/etc/fonts/conf d / 49 - sansserif. conf file, make the following changes:


<edit name="family" mode="append_last">
<string>WenQuanYi Micro Hei</string>
</edit>

The Java program section is shown in Chinese as a box solution

Create the fallback directory in the $JAVA_HOME/jre /lib/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 code", reference

The garbled code looks like this:

A. the & # 63; The & # 63; U oa & # 63; The & # 63; A3 & # 63; On the & # 63; The & # 63; The & # 63; 1 ° 2 a & # 63; The & # 63; U oa & # 63; The & # 63; A3 & # 63; On the & # 63; The & # 63; The & # 63; 1

Solutions:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

"ascii" reference

The garbled code looks like this:

%E5%8C%BB%E4%BF%9D

Solutions:

1. Use the code uni2ascii :echo

2. Install nautilus-filename-repairer0.06 (the official source code is available, but there is a dependency problem, I have not installed it successfully, and version 0.05 has a small cooperation barrier with the current nautilus, so I can only see that the name cannot be changed)

3. Download with chromeplus-1.3.3.1 (since this type of gargoyles is mainly generated after the files in the qq group are downloaded with ff (default utf8), chromeplus(default GBK) is fine)

In addition, you can search enca for the garbled content in the file.

Solve the problem of Rhythmox scrambled codes:

Install Rhythmox: sudo apt-get install rhythmbox

Install mid3iconv: sudo apt-get install python-mutagen

mid3iconv -h

Clementine garbled code problem

Install mid3iconv: sudo apt-get install python-mutagen

mid3iconv -h

Clementine does not support utf8, you need to convert all mp3 songs to gbk format, wma seems to be able to do without turning

mid3iconv-e gbk *.mp3(since you cannot take the -r parameter, enter each folder in turn)

In addition, clementine USES gstreamer as its back end, so the gstreamer plug-in needs to be installed:

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, you need to install gstreamer plugins for mms

In addition, Clementine is based on Amarok, so all plug-ins that support Amarok generally support Clementine, such as osdlyrics.

Convert file content encoding:


file -i <file name>  Detection file encoding 
iconv --help

Convert file name encoding


sudo apt-get install ibus-pinyin
0

Solve the scrambled gedit code problem:

gsettings set org.gnome.gedit.preferences.encodings auto-detected "['GB18030', 'GB2312', 'GBK', 'UTF-8', 'BIG5', 'CURRENT', 'UTF-16']"
gsettings set org.gnome.gedit.preferences.encodings shown-in-menu "['GB18030', 'GB2312', 'GBK', 'UTF-8', 'BIG5', 'CURRENT', 'UTF-16']"

Solve PDF Chinese garble:

sudo apt-get install poppler-data

Resolve the rar file garble

Using rar

Unzip the zip file

Recently, when I encountered this problem, I did a search on the Internet. What is unzip-O? Then I found an ultimate solution and used the script of python to extract the pressure. I tried it, and it worked!! The following is the code of the python script. Create a new file jieya.py and write the following code:


sudo apt-get install ibus-pinyin
1

Then put the zip file in the same level 1 directory as jieya.py, and run the command python jieya.py file.zip, oh!

smplayer Chinese subtitles messy code solution

Open options - > preferences: select the subtitle TAB.

Go to the "default character encoding" option and select "simplified Chinese (cp936)" in the drop-down box

Then open the "font" TAB (top) and select "system font" in the drop-down box to select 1 simplified Chinese font, such as Weu Quanyi Zen Hei, etc.

VLC player displays file name garbled

Modify 1 font that supports Chinese in the primary entry


Related articles: