I'm attempting to open the recently released source files of the ancient DeluxePaint on MacVim, however, every file has an unexpected sequence of ^Z^Z^Z^Z^Z... characters at the end:

unexpected characters

Two questions:

  1. What are those stray characters? Something related to a file encoding used back in the 80s by some editor?

  2. How to I get rid of them? I would like to convert the files to utf-8 or ascii, so that they display properly on any modern text editor.

1 Answer 1

  1. ^Z is a control character more or less synonymous with EOF (end of file). Maybe they were mandatory for the compiler used by the author?

  2. If you have that line in every file in the project:

    :argadd **/*
    :argdo g/<C-v><C-z>/d

    <C-v><C-z> is Ctrl+V followed by Ctrl+Z, it should insert ^Z and make the command look like:

    :argdo g/^Z/d
  • Had to change the command a bit, otherwise it only seemed to affect the first file in the args list: :argdo %s/^Z//ge | update. Got the idea for that from the :help argdo. Thanks for the help nevertheless, wasn't familiar with this command until now! :)
    – glampert
    Commented Jul 23, 2015 at 6:22
  • 2
    It could also just be a matter of "style" to add them; perhaps they displayed different in the editor that the program was written in. Commented Jul 23, 2015 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.