Friday, December 27, 2013

Re: Saving a file in utf-8.

On Friday, December 27, 2013 1:47:34 PM UTC-6, wexfordpress wrote:
> I use Vim and gvim for all kinds of files. One
>
> file type has to be saved in UTF-8 format. How do
>
> I assure this?
>

If Vim properly loads it in UTF-8, it will be default save it in UTF-8.

For that to happen, you need to do the following at the top of your .vimrc (BEFORE any mappings, etc.):

1. Set 'encoding' to utf-8
2. Set 'fileencodings' to something that will properly detect utf-8 (and/or autocmds to detect it)
3. If you're paranoid, do "set fileencoding?" in your file after loading to make sure it's in the right file encoding.

You should also be aware, does your file have (or need) a BOM? Vim will keep one there if it already exists, or you can add one by setting the 'bomb' option.

--
--
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/groups/opt_out.

No comments: