On Tuesday, April 23, 2013 10:19:57 AM UTC-5, Taro MURAOKA wrote:
> Hi list.
> 
> 
> When 'enc' is "utf-8" and 'fencs' includes "ucs-2",
> and open a file which is not "ucs-2" encoding,
> then fencs trial is terminated at "ucs-2" unexpectedly.
> 
> For example:
> 
> :set enc=utf-8
> :set fencs=ucs-2
> :e abc.txt
> 
> It is failed when opening attached "abc.txt".
> 
> 
> I wrote an attached patch to fix this.
> Please check it.
> 
> 
> Best.

OK, I wasn't sure what the problem actually was from your description, so I 
downloaded your abc.txt file and tried it myself.

On Windows 7, gvim 7.3.822, with:

gvim -N -u NONE -i NONE
:set enc=utf-8
:set fencs=ucs-2
:e abc.txt

I would expect, from :help 'fileencodings', that Vim would set 'fenc' to an 
empty string and try to read the file in the utf-8 encoding (falling back to 
the 'encoding' option).

Instead, I get a CONVERSION ERROR message and fenc is set to ucs-2.

If I use :e ++enc=utf-8 abc.txt, then the file loads correctly.

So 'fileencodings' is not working as documented when no encodings are valid for 
the file.

I tried again, with 'fencs' set to "ucs-2,utf-8,latin1" which should definitely 
succeed. It should first try ucs-2, then try utf-8 and succeed. If utf-8 had 
not succeeded, it should fall back to latin1. Instead, I see the same result: a 
CONVERSION ERROR message and fenc is now ucs-2.

I did not try your patch, but I agree this is a bug and can readily reproduce 
it on my system.

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui