Saturday, January 12, 2019

Re: E474: Invalid argument: listchars=tab:?~V?\ ,eol:¬^[^[

On Saturday, January 12, 2019 at 11:57:34 AM UTC+13, Peng Yu wrote:
> I got the following error

I looked into this and found a similarly weird bunch of errors, but *only* with my .vimrc.

TL;DR the fileencoding has been detected as latin1, and the "▸" fails to convert to latin1. A solution may be to open the offending file, :set fileencoding=utf-8, then write the file.

The smallest example of the problem I see is a two byte file, with the hex bytes bb 0a:

»

If I edit it with vim, I get a [converted] message and it displays correctly. If I then paste this into it

:set listchars+=tab:▸-

it looks ok, but if I then try to write it, there's conversion errors.

The cause, at least in my case, is that the .vimrc gets a detected with fileencoding=latin1 because there's a byte invalid for utf-8; vim converts it to utf-8 to show it, then converts back to latin1 on writing.

I think my .vimrc is vulnerable to these encoding snafus for two reasons.
Firstly, I like to use weird characters in listchars, for example "»", to use a character that's unlikely to appear in the files I edit.
Secondly, I've copied my .vimrc around many systems, going back decades, going back decades, including presumably systems that did not use utf-8, and it's accumulated a bunch of commented-out settings of listchars that have proved useful on various systems. These have the encoding from those ancient systems, which are not valid utf-8.

I can see someone else having these two things and stumbling into this, perhaps using a conversion library that generates the horrible "?UTF-8?Q?E474:_Invalid_argument:_lis? =?UTF-8?Q?" text.

HTH, and regards, John Little

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