Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

That's MSDOS charset.

Try recode cp437..u8 in a UTF8 terminal.

It gives:

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

in colour.

share|improve this answer
    
+1 for the CP437 hint. The file heuristic gets the character set completely wrong, somewhat unsurprisingly, given that it's not really text, anyway. –  tripleee Feb 3 '13 at 7:27
add comment

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.

share|improve this answer
1  
Some of the ANSI codes are actually cursor movement sequences. –  tripleee Feb 3 '13 at 7:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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