On Jul 14, 2:41 pm, Linda W <[email protected]> wrote:
> I've been trying to add the following -- and added to about 3 separate
> places
> and non have work:
>
> set fileencodings+=utf-16le
>
> First I set it in the .vimrc in my $HOME dir  (=//Bliss/<username>
> (no work)
>
> Note: $HOMESHARE=$HOME, so it was set there too
> I also tried under my USERPROFILE:
> C:\Users\<username>.BLISS
> --- but since my USERNAME=simply <username> (no domain) after it,
> I also tried the .vimrc in
> C:\Users\<username>
>
> (one with .BLISS is used when I login, authenticating my pw against
> my home domain  'Bliss' (was reference to the WinXP default background &
> screen saver of the same name, and all of WinXP's "Blissful"
> features...though
> in some respects, comparing to win7....)
>

I don't think any of the .Bliss stuff is needed. But it's easy to
figure out where Vim things it should look for your .vimrc. Go into
Vim, and run command,

   :echo $HOME

This will tell you the appropriate place to put your .vimrc.

I think Windows will look for _vimrc first, and fall back to .vimrc if
not found, or maybe it's the other way around. If in doubt, use a file
called _vimrc.

> Anyway, with the changes in all 3 places, starting GVIM
> still has file encodings set to the default:
>
> fileencodings=ucs-bom,utf-8,default,latin1
>
> So What am I doing wrong?
>

You can figure out where it was set, if it was actually set in a
script, with:

  :verbose set fileencodings?

Probably it really is still the default, however.

As for the value you are trying to set to it, you are using +=, so you
are trying to set:

  fileencodings=ucs-bom,utf-8,default,latin1,utf-16le

This will have no effect. As it will tell you in the :help, 8-bit
encodings like latin1 (and possibly 'default' as well, depending on
your locale) can never fail to load a file if the encoding is
installed on your system. Therefore, anything after 'latin1' in your
fileencodings option will never be tried.

Probably what you want, is:

  fileencodings=ucs-bom,utf-16le,utf-8,default,latin1

This will, in order:

1. Look to see if the file has a BOM. If so, it will tell Vim exactly
which Unicode encoding is being used, and Vim will use it.
2. Try utf-16le. If there are no invalid utf-16le byte sequences, Vim
uses this encoding.
3. Try utf-8. If there are no invalid utf-8 sequences, Vim uses this
encoding. Note anything using only the first half of latin1 or ASCII
will load in utf-8 as well.
4. Try whatever your locale setting says is your system encoding. If
conversion is successful, use it. If this is an 8-bit encoding, it
never fails.
5. Fall back to latin1 for anything not matched by the above 4 rules.

Possibly (I doubt this) Vim is ignoring your += since it will have no
effect. I am pretty sure Vim is not that "smart" however.

Are you setting it before or after you set your 'encoding' option? You
DO set your encoding option, don't you?

> I'm pretty sure gvim reads .vimrc before .gvimrc, as I only
> put my vim changes in .vimrc, unless they are gui-specific (like
> a gui font)...and they seem to always get picked up... but it
> isn't picking up this change!  It's like this change is being ignored.
>
> Is there a perferred order for detecting UTF-16le? in the above list?
>
> It's a rare file I need to read that uses it, but Win logfiles are in that
> format...
>
> I manually work around it by resetting my fileencodings=utf-16le, after
> I open
> the file and then use ":e<CR>"
> to re-open the current file...
>

You can always leave fileencodings as-is, and use :e ++enc=utf-16le to
work around the problem without messing with options.

Here's what I used to get started working with Unicode of various
flavors, originally by the same Tony people have mentioned already:

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