Thursday, July 3, 2014

Encoding and Fileencoding of a latin1 file

I've written this in my _vimrc file

if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,latin1
endif

When I open a latin1 file in my editor VIM indicates [CONVERTED] after the file name under the statusline.

Fileencoding has been converted to Latin1. Correct. The file will be saved in Latin1.
But my problem is that the Encoding is still in UTF-8: I see many squares in the latin1 file.

1) Why doesn't Vim also let me read the file in Latin1 (changes the encoding to latin1)?

To temporary resolve this problem I set the encoding manually to Latin1
:setlocal enc=latin1 | :e

But I noted that it changes the global encoding to Latin1 and now I see UTF-8 files in other tabs in the wrong Latin1 encoding.

2) How can I set encoding only to the local buffer?

What did I wrong?



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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment