Friday, January 28, 2011

Re: cp1252 characters when enc=utf-8, fenc=cp1252

On Fri, Jan 28, 2011 at 11:15:18AM EST, Benjamin Fritz wrote:
> On Thu, Jan 27, 2011 at 10:43 PM, Chris Jones <cjns1989@gmail.com> wrote:

[..]

> > Maybe you should set your locale to latin1 instead of UTF-8 and the
> > encoding to cp1251?
> >
>
> Latin1 has no representation for various characters which I like to
> use in my personal notes. However most of the code I work with is
> Latin1. And I want UTF-8 as my encoding so I can use fancy multibyte
> characters in 'listchars', for example, and to view the source of web
> pages encoded in UTF-8 or other unicode encodings.

Another possibility that comes to mind might be to convert your files to
UTF-16.. which I believe is the Windows way of doing unicode.

I haven't seriously looked into it, but if you stick with UTF-8, could
your initial problem be addressed by creating a mapping that sets the
value of 'encoding' to match 'fenc', issues the ga command, and resets
'encoding' to utf8 immediately afterwards?

I may be wrong about this, and I can't say I understand the
implications, but the root cause of the problem here would appear to be
that contrary to 'fenc', 'encoding' is one of those options that cannot
be set locally - if you do a ':setl enc=latin1' and switch to another
buffer, a ':set enc?' reveals that the encoding has been globally
changed to 'latin1'. I'm sure there must be very good reasons for this
behavior. The above sequence is obviously not exactly 'atomic' but
I don't see it messing up anything.

> I have the following at the top of my .vimrc right after "set
> nocompatible", it seems to work very well:

[..]

Thanks for the clarification.

I ran into similar problems when I reviewed an APL derivate called A+
that does not support any form of unicode and has its own peculiar
extended ASCII code page. I had to say good-bye to my funky unicode
listchars, tabline.. etc. and use a different .vimrc.. not wanting to
mess up the original one with a bunch of conditionals..

Not being a Windows user, I cannot think of anything practical..

You may find additional ideas by reading this document I came across
a few days ago:

| http://www.cs.tut.fi/~jkorpela/chars.html#10646

cj


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

No comments:

Post a Comment