tech-userlevel archive

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

Re: vi: invalid conversion, truncated file (Adam Hoka) writes:

>On Tue, 18 May 2010 12:11:17 +0200
>Ignatios Souvatzis <> wrote:

>> On Sat, May 15, 2010 at 12:39:04PM +0200, Thomas Klausner wrote:
>> > Hi!
>> > 
>> > 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.
>> Does this happen at reading or writing?
>>      -is

>I saw that too, it happens on :w...

The error happens when reading. If it is in a part of the file
you are editing, you see then the error then and nothing bad happens.

But if it is in a part of the file you didn't touch, it happens when
:w reads the remainder of the file. That's where the data gets

                                Michael van Elst
                                "A potential Snark may lurk in every tree."

Home | Main Index | Thread Index | Old Index