I'm using:

Neovim v0.4.4
Mac v10.13.6

When I copy non English text, for example 中文(简体) and paste it to neovim, it become ????

vim issue

The same thing happens to when I copy it from neovim and paste into any other place.

How can I fix this?

set encoding gives encoding=utf-8.

  • 1
    Does your locale and vim encoding option support these characters? That’s a likely culprit
    – D. Ben Knoble
    Oct 29, 2020 at 12:44
  • I'm not sure, how can I check this?
    – Lai32290
    Oct 29, 2020 at 12:45
  • @D.BenKnoble, I included my encoding info into the description.
    – Lai32290
    Oct 29, 2020 at 12:48
  • You should probably also check :language and :!locale, but knowing you're in utf-8 is a start. The next step is to find out if utf-8 supports those characters, and whether or not the exact ones you're coping are encoded in utf-8. Unfortunately, I'm not much help there.
    – D. Ben Knoble
    Oct 29, 2020 at 13:17
  • 1
    I can't personally recommend putting code you don't understand in your dotfiles, but that's beside the point. Environment variables like LC_ALL and LANG (there are several others) control encoding assumptions, output formats, sort order, etc. of well-written programs. Generally the correct think to do is to configure your terminal emulator or system to set them appropriately. e.g., my Macbook is in French; when I launch Terminal.app, it sets all the variables automatically. But alacritty doesn't, so I have to add them to my alacritty config. (...)
    – D. Ben Knoble
    Oct 29, 2020 at 13:57

1 Answer 1


Finally I found the solution for this.

It was because of the locale setting of my terminal, so I exported these variables in my .zshrc (maybe you can put it into .profile, if you're not using ZSH).

export LC_ALL=en_US.UTF-8
export LANG="UTF-8"
  • 1
    Usually, setting LC_ALL should be avoided, since it's stronger than all the other LC_* settings and it will override them when they're used. (Many scripts use something like LC_COLLATE=C sort or similar and this LC_ALL setting will break them. Setting LANG is usually enough, but you should set it with a language and not only an encoding. export LANG=en_US.UTF-8 is the correct setting here.
    – filbranden
    Nov 28, 2020 at 15:39
  • Many Linux distributions also support setting this in a ~/.i18n file, without the export statement, only the LANG=en_US.UTF-8 part. These distributions will have this setting work regardless of which shell is in use (bash, zsh, etc.)
    – filbranden
    Nov 28, 2020 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.