On Monday, November 12, 2012 11:00:46 AM UTC-6, J S wrote:
> Hi vim users,
> 
> I can't figure out a problem with utf-8 in (g)vim. I would like to use utf-8
> as encoding but the status line changes when I do that (set encoding=utf-8)
> and german Umlaute are not displayed correctly any more. There is some odd
> character representation shown, e.g. <e4> instead of ä. Strangely though this
> seems to be a problem only for the lower case letters. If I hit i for insert
> mode the status line changes to EINFÜGEN (german for INSERT), which is
> correct.
> 
> 
> When I reencode to latin1 everything is back with Umlaut.
> 

Try setting 'encoding' in your .vimrc, at the very beginning, instead of after
Vim starts up. :help 'encoding' says:

        NOTE: Changing this option will not change the encoding of the
        existing text in Vim.  It may cause non-ASCII text to become invalid.
        It should normally be kept at its default value, or set when Vim
        starts up.

In other words, DON'T change 'encoding' after Vim starts up. You should only
ever change it once at the beginning of your .vimrc.

My guess is that you are setting your statusline to text containing non-ASCII
characters, then setting 'encoding', which causes Vim to reinterpret the bytes
which are valid for Latin1 as UTF-8 without conversion.

See http://vim.wikia.com/wiki/Working_with_Unicode

-- 
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

Reply via email to