In ubuntu, garbled characters occur when gedit is used to open the GBK character set encoding file. Solution: When Gedit is used to open a text file written in Windows, all Chinese characters in the file are garbled. Some txt files that can be opened in Windows are opened in gedit In Ubuntu. Chinese characters are garbled because of different encoding methods. In Windows, the default txt file encoding method is GBK, while in Ubuntu, gedit does not support GBK by default. Www.2cto.com: Open the terminal and enter the following two Commands: 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'] "restart Gedit to display Chinese content normally. The preceding two commands are equivalent to opening the application-system tool-configuration editor (or entering: gconf-editor in the terminal -- this software needs to be installed -- executing sudo apt-get install gconf-editor ), create the auto-detected shown-in-menu Sub-keys under apps/gedit-2/preferences/encodings. The sub-key content is as follows. After completing the preceding settings, gedit can automatically detect the character set of the text file and correctly display the text created in windows as a GBK file.