I've found this website; it has zip files (links on the main page) with all the artworks. Some of them have an .ans extension and they look like ANSI escape codes used on Linux/Unix, but when I open one of them using cat in the XFce terminal it produces garbage (but in color). They don't look like the image gallery.

The first line of the main artwork from the link looks like this (copied from Emacs):

[0;1m[30mthere is no substitute [0;33mÜܲ[1;43m°±²²[40mÛ[43mÛ²±[0;33mÝ ßÜ[1;43m²²²[40mÛÛ²[40m[K

The file type is DOS, but they can be just created on Windows.

When searching for ANSI art I also found this website that has zip files containing only files with an .ans extension and they also don't render properly on Linux (gallery on page 2).

My questions are:

  • what type of encoding is this, for what computer?
  • do I need a special viewer to see it on Linux terminal?
  • do you know if this type of artwork was created for Linux/Unix terminals? I've only found ASCII art.
  • is it possible to convert it to be viewed on Linux terminals?
  • 1
    The data part isn't UTF-8: if you knew what encoding it used, you could use recode or iconv to translate it. Or (knowing the encoding), you could use luit to translate it, using cat to the display. Knowing the encoding is probably something for superuser forum, not topical here. – Thomas Dickey Oct 15 at 8:02
up vote 30 down vote accepted

These are ANSI escape codes, but you’re running into three issues:

  • the character encoding, as you suspect — most of these files are in CP437, so you need to convert them:

    iconv -f CP437
    

    (use the -t option if you need to specify the target encoding; by default iconv will match the current locale’s character encoding);

  • the colour scheme — these files typically assume something similar to the CGA/EGA/VGA colour scheme used on PCs; terminal emulators generally allow you to choose a colour scheme (or redefine colours manually), for example GNOME Terminal has a “Linux console” built-in scheme which works well for ANSI art;

  • the screen size — most ANSI art assumes a screen width of 80 columns and expects to wrap around there.

Once you fix all that, you don’t need a special viewer; here’s a screenshot showing the output of aa-neurodancer.ans in GNOME Terminal, after converting the character encoding:

ANSI art showing a human head with spectacles

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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