3

I have stumbled upon a strange text file in an archive of an old dos game downloaded from some abandonware site.

The text file is named WHY_NOT.TXT. I assume the file is some sort of .NFO file from the group of people who ... um ... 'liberated' the game.

I had not much luck viewing the file using cat or less or even nfoview.

The question is: how can I view the content of the file as intended?

Output from nfoview:

nfoview

Here is the output of cat and less. I use screenshots because I fear the encoding will get messed up more by the browser and the internets.

catless

Output of file:

$ file WHY_NOT.TXT WHY_NOT.TXT: ISO-8859 text, with CRLF line terminators, with escape sequences 

Here is the file in raw hex dump created using xxd -p WHY_NOT.TXT:

1b5b34306d0d0a1b5b33396d1b5b34306d0d0a1b5b33396d1b5b34431b5b 303b33346ddb1b5b316ddbdfdfdfdfdfdf201b5b303b33346ddb1b5b316d dbdfdfdfdfdfdb201b5b34346d201b5b34306ddbdfdfdfdfdfdb201b5b30 3b33346ddb1b5b316ddbdfdfdbdfdfdb201b5b303b33346ddb1b5b316ddb 1b5b36431b5b34346d201b5b34306ddbdfdfdfdfdfdb201b5b303b33346d db1b5b316ddbdfdfdb201b5b303b33346ddb1b5b316ddb201b5b303b3334 6ddb1b5b316ddbdfdfdfdfdfdc0d0a202020201b5b303b33346ddb1b5b31 6ddbdcdcdcdcdcdc201b5b303b33346ddb1b5b316ddbdcdcdcdc1b5b3434 6ddc1b5b34306ddb201b5b34346d201b5b34306ddbdcdcdcdc1b5b34346d dc1b5b34306ddb201b5b303b33346ddb1b5b316ddb201b5b303b33346ddb 1b5b316ddb201b5b303b33346ddb1b5b316ddb201b5b303b33346ddb1b5b 316ddb1b5b36431b5b34346d201b5b34306ddbdcdcdcdc1b5b34346ddc1b 5b34306ddb201b5b303b33346ddb1b5b316ddb201b5b303b33346ddb1b5b 316ddb201b5b303b33346ddb1b5b316ddb201b5b303b33346ddb1b5b316d db202020201b5b303b33346ddb1b5b316ddb0d0a1b5b3130431b5b303b33 346ddc1b5b316ddb201b5b303b33346ddb1b5b316ddb1b5b37431b5b3434 6d201b5b34306ddb202020201b5b303b33346ddc1b5b316ddb201b5b303b 33346ddb1b5b316ddb202020201b5b303b33346ddb1b5b316ddb201b5b30 3b33346ddb1b5b316ddb1b5b36431b5b34346d201b5b34306ddb20202020 1b5b303b33346ddc1b5b316ddb201b5b303b33346ddb1b5b316ddb201b5b 303b33346ddb1b5b316ddb201b5b303b33346ddb1b5b316ddb201b5b303b 33346ddb1b5b316ddb202020201b5b303b33346ddb1b5b316ddb0d0a2020 20201b5b303b33346ddc1b5b316ddcdcdcdcdc1b5b34346ddc1b5b34306d db201b5b303b33346ddb1b5b316ddb1b5b37431b5b34346d201b5b34306d db202020201b5b34346d201b5b34306ddb201b5b303b33346ddb1b5b316d db202020201b5b303b33346ddb1b5b316ddb201b5b303b33346ddb1b5b31 6ddbdcdcdcdcdc201b5b34346d201b5b34306ddb202020201b5b34346d20 1b5b34306ddb201b5b303b33346ddb1b5b316ddb201b5b303b33346ddb1b 5b316ddbdc1b5b34346ddc1b5b34306ddb201b5b303b33346ddb1b5b316d dbdcdcdcdc1b5b34346ddc1b5b34306ddf0d0a1b5b306d1b5b323535440d 0a 

You can recreate the original file by copying that string to a file and then use xxd -r -p filename. Here is the md5sum to be really sure that you have the identical original file: e64665b3f6e5fb3ec71c8fbf6cc63875

3 Answers 3

4

That's MSDOS charset.

Try recode cp437..u8 in a UTF8 terminal.

It gives:

██▀▀▀▀▀▀ ██▀▀▀▀▀█ █▀▀▀▀▀█ ██▀▀█▀▀█ ██ █▀▀▀▀▀█ ██▀▀█ ██ ██▀▀▀▀▀▄ ██▄▄▄▄▄▄ ██▄▄▄▄▄█ █▄▄▄▄▄█ ██ ██ ██ ██ █▄▄▄▄▄█ ██ ██ ██ ██ ██ ▄█ ██ █ ▄█ ██ ██ ██ █ ▄█ ██ ██ ██ ██ ██ ▄▄▄▄▄▄▄█ ██ █ █ ██ ██ ██▄▄▄▄▄ █ █ ██ ██▄▄█ ██▄▄▄▄▄▀ 

in colour.

2
  • +1 for the CP437 hint. The file heuristic gets the character set completely wrong, somewhat unsurprisingly, given that it's not really text, anyway. Commented Feb 3, 2013 at 7:27
  • Beware, recode will modify the file in-place. Here's a pipe-friendly command: iconv -f cp437 file.nfo |less Commented Aug 29, 2024 at 16:16
1

Some clues about the color:

The ESC[0;33m; things are ANSI escape sequences used for adding color to console output. 'ESC' in ascii is decimal 27 or octal 33, so you can pass that to the shell with \\033 and see what I mean:

echo -e "\\033[0;32mgreen \\033[1mbright \\033[44mon blue\\033[0m and reset..." 

Remember, the \\033 is ESC. Look familiar? A lot of them only set the background, and some of the file is spaces -- hence the stylized SPAMLAND.

Note that those sequences don't work on the MS windows terminal emulator.

1
  • 1
    Some of the ANSI codes are actually cursor movement sequences. Commented Feb 3, 2013 at 7:29
0

Thanks for the hint about recode Stéphane Chazelas.

I had another nfo file and it used CP866.

https://en.wikipedia.org/wiki/Code_page_866

The code page was shown in the list of different encodings in the mousepad text editor.

So for viewing that file I just used this command:

cat fairlight.nfo | recode cp866..u8 | less 
1
  • How did you determine what code page your file used? … … … … … … … … … … … … Please do not respond in comments; edit your answer to make it clearer and more complete. Commented Jul 26, 2022 at 4:42

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.