search

Home  >  Q&A  >  body text

ubuntu16.04 - ubuntu mate 16.04 vim (gvim?) Chinese garbled code cannot be solved

Problem Description

Garbled characters that appear in the ubuntu (ubuntu mate16.04 to be precise) environment
The test document is called "Chinese"
The terminal used iszsh

As shown below, the Chinese display in vim terminal is normal

Then using windowed vim, box-like garbled characters appeared. The opening command is right-click menu-open with-vim

Try the solution

Searched Google many times, and the solution was to modify the encoding part of the vimrc file. My personal vimrc settings are as follows:

set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
set fileencoding=utf-8
set encoding=utf-8

However, the problem still exists, please help solve it!

--
2016-07-26 11:04:41
According to @daya's answer, it may be a gvim font problem. Try /etc/vimgvimrc and ~ /.gvimrcAdd the following configuration to the file

set guifont=Sans serif 14¬
"set guifont=Nimbus\ Mono\ L\ 14¬
"set guifont=Bitstream\ Sans\ Mono\ 9¬
set guifontwide=NSimsun\:h12  " Changes the fonts that can correctly show Chinese¬
let $LANG ='zh_CN.UTF-8'¬

The problem cannot be solved.

巴扎黑巴扎黑2751 days ago803

reply all(2)I'll reply

  • 迷茫

    迷茫2017-05-16 16:38:17

    1. That is not windowed vim, but another terminal.
    Confirmation method, enter: ver, check whether the first line is gvim or vim.
    2. There is a problem with the font configuration of this terminal. Anyone with Ubuntu 16.04 please verify what terminal it is.
    If you know what terminal it is, you know how to modify the font configuration.
    3. By default, ubuntu does not install gvim, you need to install it manually.
    sudo apt-get install gvim
    Follow the prompts.

    reply
    0
  • PHPz

    PHPz2017-05-16 16:38:17

    This is not gibberish, this is the fault of the font. Solution:
    Create a new .gvimrc file and write the font configuration.

    reply
    0
  • Cancelreply