Monday, May 23, 2011

Re: what's a "conversion error" and how do I correct it?

On May 23, 3:59 am, Erik Christiansen <dva...@internode.on.net> wrote:
> On 22.05.11 11:55, Ben Fritz wrote:
>
> > On May 22, 6:00 am, Christian Brabandt <cbli...@256bit.org> wrote:
> > >  or you can force Vim to save it in utf-8
> > > encoding, by issuing :w ++enc=utf8 filename.
>
> > This is true, but you can also do a
>
> > :setlocal fileencoding=utf-8
>
> Thank you both! I've also been irritated by occasional write failure due
> to conversion error, after pasting text to vim. A quick overwrite of the
> offending characters in vim has always cured the problem. Yesterday it
> was a weird minus sign. I see now that the file is latin1.
>
> Presumably the old and new encodings sync after setting fileencoding=utf-8,
> so I wouldn't still have two kinds of '-' ? (I have no idea how many
> different minus signs and hyphens are included amongst utf-8 multibyte
> characters.)
>

They will "sync" only if your 'fileencodings' and 'encoding' options
are set in a way that the proper encoding is detected when reading the
file.

See the help for each option, and also http://vim.wikia.com/wiki/Working_with_Unicode
as mentioned before.

Something I've also found useful for those times Vim cannot properly
recognize the encoding by itself, is the AutoFenc plugin:

http://www.vim.org/scripts/script.php?script_id=2721

I only use it for those cases where the encoding is specified in the
file text (like in many HTML documents), but I know there's also an
option to use an external tool to determine encoding based on file
content.

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

No comments: