Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My .vimrc contains:

if $LANG =~ '\(UTF\|utf\)-\?8' || $LC_CTYPE =~ '\(UTF\|utf\)-\?8'
  set list listchars=tab:»·,trail:~,extends:>,precedes:<

But there is some chars which is unicode, when I run vim under LC_CTYPE=zh_TW.Big5 environment, it will show

Error detected while processing /home/user/.vimrc:
  line   70:
E474: Invalid argument: listchars=tab:»·,trail:~,extends:>,precedes:<
share|improve this question
up vote 4 down vote accepted

Add the following line to your vimrc, preferably near the beginning:

scriptencoding utf-8

That will tell vim to read the file as UTF8 even if you're on a non-UTF system. It will then transcode any characters from that into your current encoding. If the characters you're using in the listchars option exist the other encodings that you use you shouldn't even need to have the conditional around that.

share|improve this answer
This method works on vim, but, I found gvim still shows that error message. – Daniel YC Lin Feb 25 '13 at 5:11
Do you have a .gvimrc file that also contains unicode characters? If so, adding the same line to that file should fix the problem there as well. That command only applies to the file in which it is found, so would need to be included in any vim configuration file where the character encoding is important. – qqx Feb 25 '13 at 15:39
I found the problem caused by my gvimrc and fixed it. – Daniel YC Lin Feb 27 '13 at 1:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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