On Windows, what is the best way to convert a binary file where the internal structure is unknown less that its contents are ASCII in nature back to plain text?
Ideally the conversion would produce a "human"-readab开发者_如何学Pythonle version. I think the file should contain something like the following:
Date: 10 FEB 2010
House: 345 Dogwood Drive
Exterior: Brick
In Linux/Unix:
$ strings < unknown.dat > ascii-from-unknown.txt
This is of course not so much a "conversion" as a straight up extraction, by just filtering out the non-ASCII bytes. It's useful quite often, though.
In general, without more knowledge of the file's internal format, I don't think you can do much better.
Depending on what exactly you want to achieve, a hex dump might fit the bill: It's a pure ASCII format that represents the entire file without any loss of data (but being quite wasteful with space).
It is not really human readable, but since you don't explain why you want to do that, it's the best I can offer.
There are several simple tools that produce a hex dump on Windows.
精彩评论