Sunday, March 28, 2010

Re: Can't save file due to "CONVERSION ERROR in line..."

>> I can't precisely answer this, but I'll give you some guesses: I'll
>> guess that the browser is using one encoding and you have gvim/vim using
>> a different, incompatible encoding. I'm not sure how to determine what
>> encoding your browser is using, but the encoding for vim can be checked
>> with
>>
>> set enc
>> set fenc
>>
>> If you can live with utf-8, try using that.
>>
>> Regards,
>> Chip Campbell
>>
>
> Yes indeed.
>
> Conversion error when saving the file means that the file in the buffer (in
> the 'encoding' charset) contains one or more characters which cannot be
> represented in the 'fileencoding' charset which you're trying to save the
> file in. For instance, the file contains an œ character (French oe digraph)
> and you're trying to save it in Latin1.
>
> If the conversion error happens when reading or pasting into Vim memory,
> then your 'encoding' is not compatible with the data; IOW, Vim cannot
> represent the data in memory with the present choice of 'encoding'.
>
> I recommend to use UTF-8 for the data in Vim memory ('encoding'), because
> Unicode (including UTF-8) can represent any possible computer charset.
> Conversion between Unicode and Latin1 is trivial and Vim (if compiled with
> +multi_byte of course, i.e. if has('multi_byte') is nonzero) can do it
> without external help; conversion to or from some other non-Unicode charset
> (or to or from GB18030, which technically is a Unicode charset but requires
> large conversion tables) usually requires the iconv library, either
> compiled-in or available for dynamic load at runtime (to check it, make sure
> that has('iconv') has a nonzero value).
>
> See also http://vim.wikia.com/wiki/Working_with_Unicode and the help pages
> mentioned there.
>
> See also :help 8g8
>
>
> Best regards,
> Tony.

Hi,

Thanks for the tips. Following two of them didn't really solve the issue.
set enc returns
encoding=utf-8

and set fenc returns
file encoding=latin1

How can I know which of them actually applies?- the utf-8 or the
latin1?- And how can I make sure utf-8, assuming this will resolve the
error, applies?

the 8g8 is nice but it's not robust enough to help me cope with 2k
line choke full of encoding wise illegal chars.
The tip though had an example of encoding settings. I added it to my
vimrc and it resolved the problem. For the record, end and fenc
remains the same after I apply the tip. The problem is gone though and
I can copy paste the problematic text to vim and save w/o error.

Thanks!
Yosi

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

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments: