Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neovim trips on UTF-8 characters #1858

Closed
janko opened this issue Jan 21, 2015 · 3 comments
Closed

Neovim trips on UTF-8 characters #1858

janko opened this issue Jan 21, 2015 · 3 comments
Labels

Comments

@janko
Copy link

janko commented Jan 21, 2015

I installed the latest master of Neovim. However, I have some UTF-8 characters in my .vimrc, and also when I open a file with UTF-8 characters, Neovim throws an error for each UTF-8 character it finds (each error message is different, because they appear in different contexts, so I can't pull out a specific one). I have a :set encoding=utf-8 in my .vimrc, and Neovim was working fine before, there was just some change meanwhile that trips it up now.

@janko janko changed the title Neovim now trips on UTF-8 characters Neovim trips on UTF-8 characters Jan 21, 2015
@ghost
Copy link

ghost commented Jan 21, 2015

:set encoding=utf-8

That's default, so shouldn't be needed (unless your locale set by $LANG isn't UTF-8). I triggered the following error by setting $LANG to en_US.ISO-8859-1 and launching nvim:

Error detected while processing function gitgutter#highlight#define_signs..gitgutter#highlight#define_sign_text:
line    4:
E239: Invalid sign text: @�
Press ENTER or type command to continue

Are your error messages similar to that? And can you verify that encoding is indeed being set to utf-8 by running :set encoding in a UTF-8 encoded file?

@janko
Copy link
Author

janko commented Jan 21, 2015

Yes, I'm also using vim-gitgutter, and one of the errors is exactly this one.

It seems the following lines somehow dissapeared from my .bash_profile, and when I add them back, Neovim works properly:

export LC_ALL=en_US.UTF-8  
export LANG=en_US.UTF-8

Neovim worked before with UTF-8 without these settings, but that was probably an unintended "feature", which got rightfully removed.

@janko janko closed this as completed Jan 21, 2015
luonet added a commit to luonet/dotfiles that referenced this issue Jun 24, 2015
在声明listchars使用了非utf8字符,在非utf8环境下启动vim会出错:Invalid argument: listchars

解决方案如下:

1. 在vimrc中添加(http://stackoverflow.com/questions/18321538/vim-error-e474-invalid-argument-listchars-tab-trail):

   scriptencoding utf-8

2. 在.bash_profile中添加(neovim/neovim#1858):

   export LC_ALL=en_US.UTF-8
   export LANG=en_US.UTF-8

目前使用第一种解决方案,因为不会污染系统环境
@ZyX-I
Copy link
Contributor

ZyX-I commented Apr 19, 2016

@janko-m .bash_profile is actually not a good place for these settings. I have $LANG ($LC_ALL is not defined) in /etc/env.d/99locale (AFAIR file was created when system was installed) which specifies data for automatically generated /etc/profile.env which is sourced by /etc/profile. Pretty sure your distribution has something like this to specify $LANG system-wide. And I think without this setting system-wide if your locale was any but English you would not get correct locale in GUI applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants