Bug#432004: vim: detection of file encoding sometimes fails

James Vega jamessan at debian.org
Thu Apr 3 02:14:32 UTC 2008


On Fri, Jul 06, 2007 at 05:53:34PM +0200, Adeodato Simó wrote:
> I had a file in iso-8859-1 encoding with the word "adiós". This was
> recognized as an utf-8 file. Changing the word to "adiós." makes it get
> recognized as iso-8859-1.
> 
> Some more tests:
> 
>   adiós         => wrong
>   adiós.        => correct
>   ó             => wrong
>   ó.            => wrong
>   .ó.           => wrong
>   á             => wrong
>   á.            => correct

I created a separate file for each of these scenarios and verified that
they were iso-8859-1 encoded.  I then opened each file using this
command:

  env LANG=es_ES.ISO-8859-1 vim -u NONE -U NONE testfile

Running the Vim command ":set enc? fenc?" I verified that Vim detected
each file as latin1 since 'enc' was set to latin1 and 'fenc' was empty
(and therefore the same as 'enc').

I tried the steps above 3 more times with LANG set to es_ES.UTF-8,
en_US.UTF-8, and en_US.ISO-8859-1.  When LANG was set to a UTF-8
encoding, 'enc' was utf8 and 'fenc' was latin1 as expected.  In other
words, every permutation I tried work properly.

The one "problem" I ran into was when I was using the ISO-8859-1
locales.  The file did not display properly but that was because I was
running xterm in utf8 mode and had to set Vim's 'tenc' option to utf8.

Are you still able to reproduce the problem?  If so, could you tell me
what piece of the puzzle I'm missing here? :)

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20080402/13e29b66/attachment.pgp 


More information about the pkg-vim-maintainers mailing list