Questions tagged [ansi]

ANSI escape sequences are characters embedded in the text used to control formatting, color, and other output options on video text terminals. Almost all terminal emulators designed to show text output from a remote computer, and (except for Microsoft Windows) to show text output from local software, interpret at least some of the ANSI escape sequences.

ANSI escape sequences are characters embedded in the text used to control formatting, color, and other output options on video text terminals. Almost all terminal emulators designed to show text output from a remote computer, and (except for Microsoft Windows) to show text output from local software, interpret at least some of the ANSI escape sequences.

UNIX

Most terminal emulators running on Unix-like systems (such as xterm and the OS X Terminal) interpret ANSI escape sequences. The Linux console (the text seen when X is not running) also interprets them. Terminal programs for Microsoft Windows designed to show text from an outside source (a serial port, modem, or socket) also interpret them. Some support for text from local programs on Windows is offered through alternate command processors such as JP Software's TCC (formerly 4NT), Michael J. Mefford's ANSI.COM, and Jason Hood's ansicon. Many Unix console applications (e.g., ls, grep, Vim, and Emacs) can generate them. Utility programs such as tput output them, as well as in low-level programming libraries, such as termcap or terminfo, or a higher-level library such as curses.

Windows and DOS

MS-DOS 1.0 did not support the ANSI or any other escape sequences. Only a few control characters (CR, LF, BS) were interpreted, making it impossible to do any kind of full-screen application. Any display effects had to be done with BIOS calls (or far more often by directly manipulating the IBM PC hardware).

MS-DOS 2.0 introduced the ability to add a device driver for the ANSI escape sequences – the de facto standard being ANSI.SYS, but others like ANSI.COM, and NANSI.SYS are used as well. Extreme slowness and the fact that it was not installed by default made usage by software almost non-existent; software continued to directly manipulate the hardware to get the text display needed. ANSI.SYS and similar drivers continued to work in through Windows 98, and even in Windows Me, when they were set to native DOS mode (the characters taking the whole screen). ANSI.SYS also worked in NT-derived systems for 16-bit legacy programs executing under the NTVDM.

The Win32 console does not support ANSI escape sequences at all. Software can manipulate the console with the ioctl-like Console API interlaced with the text output. Some software internally interprets ANSI escape sequences in text being printing and translates them to these calls[citation needed].

8 questions
10
votes
1 answer

How to "un-ANSI-fy" logs?

Lately there has been a tendency by command line tools to use fancy ANSI colors in their log output (for example, NPM and a host of nodejs based tools, rvm, docker, and a few other "modern" tools). This makes it nice to read on the screen(*), but…
Guss
  • 2,520
  • 5
  • 32
  • 55
5
votes
2 answers

How to enable ANSI escape codes in Windows cmd?

What is the simplest way to enable ANSI escape codes (eg. colored output) in Windows cmd?
Jakub Arnold
  • 1,674
  • 10
  • 25
  • 33
4
votes
1 answer

How to "screenshot" a terminal with ANSI colors and export to HTML?

I want to do a full screen copy of some terminal output, with ANSI colors, and generate HTML so I can post to a blog or wiki. My real world example: I want to document top with all of its ANSI color goodness. (I'd rather not do a bitmap screenshot.…
David J.
  • 199
  • 1
  • 6
2
votes
0 answers

Trying to run a netsh batch with foreign characters

I am trying to run a batch file with the following content: netsh interface ip>set dns "Połączenie lokalne" source=dhcp The file is saved as ANSI. My Windows codepage is 1250, the OEM one 852. Thus, since Windows uses ANSI (ACP) while the console…
Tin
  • 21
  • 1
0
votes
2 answers

Force .js files saved in ANSI encoding to show in UTF-8 on IIS 7.5

I'm migrating a web system that now works on windows server 2003 IIS 6, to IIS 7.5 on windows 2008 server This system generates javascript files with accented characters in ANSI (Portuguese - Brazil). These javascripts shows for example alert…
Xcarpa
  • 1
  • 2
0
votes
1 answer

VPS displaying funny characters instead of special characters

Pretty sure it doesn't matter but I've had about a dozen OpenVz vps' and never seen this until I bought a Xen server for the first time. Special characters like « get all funky and look like this: � What can be done to so the characters display…
dukevin
  • 1,610
  • 3
  • 18
  • 25
0
votes
1 answer

How to display ANSI Escape codes e.g. from tshark telnet trace?

How does one display/visualize a trace of a session with ANSI Escape codes embedded in it? I have a tshark trace of a telnet session to a HP switch. From that, I Follow TCP Stream and get a pseudo-text representation of the telnet session (with…
Peter V. Mørch
  • 812
  • 7
  • 15
0
votes
1 answer

How can I convert a large ANSI text file to UTF-8?

For a database migration I need a tool which can convert a 1 GB file from Ansi codepage to UTF8 on Windows. Maybe I can use sed (given that I know all search and replace values), but is there something included in GNU or Windows tools?
mjn
  • 933
  • 2
  • 12
  • 26