On 2019-01-13, Peng Yu wrote:
> > This is the problematic setting. In Latin1 encoding, Vim can only
> > represent in its internal memory the 256 characters supported by
> > Latin1, and that dark triangle is not one of them. See at
> > https://vim.wikia.com/wiki/Working_with_Unicode (which my previous
> > post also mentioned) how to set up Vim so that it can handle any
> > Unicode codepoint.
>
> I download the vim source code and compiled it from scratch on the
> ubuntu docker container. But vim still does not recognize UTF-8
> characters.
>
> Why is it so? Shouldn't vim recognize UTF-8 characters out-of-the-box?
>
> I put the following code at the beginning of my viimrc. I don't see
> the problem solved either.
>
> if has("multi_byte")
> if &termencoding == ""
> let &termencoding = &encoding
> endif
> set encoding=utf-8
> setglobal fileencoding=utf-8
> "setglobal bomb
> set fileencodings=ucs-bom,utf-8,latin1
> endif
I'm pretty sure now that this is a conflict between your locale
setting and the character set used in your vimrc. The machine on
which I have docker installed isn't working at the moment, so
I tried a different experiment. On a machine running Ubuntu 16.04,
I executed the following:
$ LANG=POSIX
$ vim
Error detected while processing
/home/gary/.vim/vimrc:
line 928:
E474: Invalid argument: listchars+=tab:�~V�-
Press ENTER or type command to continue
:set enc?
encoding=latin1
I repeated the experiment with LANG=C with the same results. The
error is at the line where I assign your little triangle to
'listchars'. I don't see this error when my locale is set for
UTF-8, as it is by default. This seems to confirm that your docker
installation of Ubuntu is set up for some encoding other than UTF-8.
That locale setting tells vim to expect the files it sources,
including vimrc, to contain only characters from that character set.
As a solution to this, I added the following at the top of my vimrc:
set encoding=utf-8
scriptencoding utf-8
per ":help :scriptencoding".
With that, I see no errors when I start VIM in the POSIX or
C locale.
You could also execute this in your docker container's shell:
$ locale -a
and see if your language and UTF-8 encoding is supported. If it is,
then just set LANG to that in your ~/.profile, or whatever the
preferred file du jour is for that sort of thing these days.
Regards,
Gary
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment