[plt-scheme] help! corrupted binary file

From: Richard Cobbe (cobbe at ccs.neu.edu)
Date: Fri Oct 21 09:18:35 EDT 2005

On Fri, Oct 21, 2005 at 08:11:49AM -0400, Allie Jacobs wrote:
> I wrote a lot of code last night, and this morning I needed to put 
> finishing touches on it, and I got a lovely error message saying my file 
> could not be opened. Yay.
> 
> Does anyone have a script to bring a corrupted binary file back to text? 
> [and how to use it?]
> 
> any help at all would be much appreciated.

I don't have a script, but a little bit of work with Emacs will get you
almost all of the way there.  These three steps will remove the bulk of
the binary stuff:

   * M-x replace-regexp C-q C-@ C-q C-@ . . . RET RET
        (that is, replace the regexp "^@^@..." with nothing, where "^@"
        represents ASCII 0)
     (Thanks to Felix Klock, who discovered this regexp.)

   * delete the large binary header that remains

   * clean up any images or other non-text things in the document.
     Since images are stored as binary, you'll have to reload those from
     within DrScheme, but you may be able to recover the contents of
     other special things like test cases.

You may have a little bit of additional cleanup to do -- control
characters inside identifiers, broken whitespace, etc., but that's
relatively straightforward.

HTH,

Richard


Posted on the users mailing list.