tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

vi: invalid conversion, truncated file


When opening a file in vi in a UTF-8 environment, doing changes and
saving-and-quitting, I sometimes open files that are not valid UTF-8
files (e.g. iso-8859-1).

vi then claims "invalid conversion" and truncates the file at the
first invalid character.

I don't see how this can _ever_ be what the user wants (well, perhaps
sometimes, but not in >90% of the cases -- definitely not in 100% of
my usage cases).

Can we come up with a better handling of these files? For example, one

. just skip the character(s), possibly replacing it with some special
  character sequence so it's obvious where a character was removed, and
  continue writing the rest
. not save, but go to the position so the user can decide what to do
. just leave the character alone and write the file as it was before


Home | Main Index | Thread Index | Old Index