Live data from Hacker News

Inspect ANSI control codes and escape sequences

ansi.tools

31–40 of 52 posts

Re: Inspect ANSI control codes and escape sequences

#31

The things they don't prepare you for in school... I was working at my first job and we had a ColdFusion app that was displaying some data from the database. I get a ticket one day saying our search page would crash when searching for a very specific document. The other 1 million+ documents all loaded fine to our knowledge, so why this one? I was pretty junior back then and feeling mighty defeated as to why I couldn'…

There are also zero-space width characters, yeah utf is a rabbit hole

Re: Inspect ANSI control codes and escape sequences

#32
post #31

The things they don't prepare you for in school... I was working at my first job and we had a ColdFusion app that was displaying some data from the database. I get a ticket one day saying our search page would crash when searching for a very specific document. The other 1 million+ documents all loaded fine to our knowledge, so why this one? I was pretty junior back then and feeling mighty defeated as to why I couldn'…

There are also zero-space width characters, yeah utf is a rabbit hole

Emojis and other unicode characters may or may not be rendered as a single-width character. I've been splitting hairs and strings.

The tool currently counts any unicode character as a single-width one.

Re: Inspect ANSI control codes and escape sequences

#33
post #21
post #14

"\u001b[0m — reset" ... what? Why SGR is not called by name, while, e.g. CUU is? strange... According to which terminal or standard it interperts sequences? Is this tool really helpful? It does look nice! But it does not help with the corneriest cases that would benefit from such tool the most.

Got to start somewhere! Didn't see many examples to get inspired by either. Here's the full table: https://ansi.tools/lookup . This is my initial take on it. Please bring in the corneriest cases! It's open source so bug reports, RFCs and pull requests are most welcome.

This thing is made out of corner cases: https://www.invisible-island.net/vttest/

I am sure capturing it's output will provide endless source of amusement and despair.

There are sequences from real terminal (e.g. stuff documented at vt100.net), sequences from ECMA 48 and friends (most of it likely never implemented), and de-facto behaviour of different software. Infamous examples being original windows terminal, rxvt (ugh), linux co nsole, emacs terminal.

Most vexing behaviour is background fill on newline, incorrect characters in terminal reports, broken scroll region, inability to write in bottom-right position etc.

This project looks fun! But it leads to endless narrow abandoned places. Hopefully you will enjoy the experience!

Re: Inspect ANSI control codes and escape sequences

#34
post #21
post #14

"\u001b[0m — reset" ... what? Why SGR is not called by name, while, e.g. CUU is? strange... According to which terminal or standard it interperts sequences? Is this tool really helpful? It does look nice! But it does not help with the corneriest cases that would benefit from such tool the most.

Got to start somewhere! Didn't see many examples to get inspired by either. Here's the full table: https://ansi.tools/lookup . This is my initial take on it. Please bring in the corneriest cases! It's open source so bug reports, RFCs and pull requests are most welcome.

Ghostty the terminal emulator has a cell inspector feature along these same lines

Re: Inspect ANSI control codes and escape sequences

#35

The things they don't prepare you for in school... I was working at my first job and we had a ColdFusion app that was displaying some data from the database. I get a ticket one day saying our search page would crash when searching for a very specific document. The other 1 million+ documents all loaded fine to our knowledge, so why this one? I was pretty junior back then and feeling mighty defeated as to why I couldn'…

Similarly, I once copied a shell script out of Slack and saw a bunch of red errors from my IDE when I pasted it in. The errors were on every line that had a new line on it. The error was "â: Command not found", despite there being no such character on the line.

Pasted it into a hex editor, tracked down the bytes, and while I can't currently remember specifically what the encoding problem was, it was something to do with going between UTF-8 > ISO-8859 > UTF-8 again.

I've since aliased `pbpaste | xxd` (macOS, linux has similar CLI tools for working with the clipboard depending on your distro/DE), because weird shit like this comes up more often than I'd care to admit. Last rabbit hole was discovering that in macOS 15, Apple changed one of the the "space" characters in the default Screenshot file names, but only if your Mac is set to use 12-hour time from a normal ASCII 0x20 space, to a Unicode 'U+202F NNBSP' "non-breaking space" between the time and AM/PM, which was causing S3 uploads to fail.

Re: Inspect ANSI control codes and escape sequences

#38

The things they don't prepare you for in school... I was working at my first job and we had a ColdFusion app that was displaying some data from the database. I get a ticket one day saying our search page would crash when searching for a very specific document. The other 1 million+ documents all loaded fine to our knowledge, so why this one? I was pretty junior back then and feeling mighty defeated as to why I couldn'…

CudaText is better than Notepad++ in this regard. It shows ASCII control chars always. The option for "unprinted chars" only hides "arrows" over spaces/tabs.

Re: Inspect ANSI control codes and escape sequences

#39

This is a fantastic web util; bookmarked for the future. I wish I had this when I was making, [Dragon's Oven]( https://tronster.itch.io/dragon ). It was a lot of nights and weekends of tinkering with ANSI codes in Typescript. I learned a lot that surprised me, such as: most modern OS's still don't support 16m colors out of the box and that the default Linux shell doesn't support beyond 16 colors. Also no really good…

TheDraw was a cornerstone of my teenage years. I would log into different BBSs just to see their ANSI welcome screens, then I would try and re-create them to learn the art. It was a unique form of animation and I was hoping you had figured out how to get TheDraw working. I also later used ANSI to make my own cool command line prompts in DOS and later, Linux.

Recreate them? we would steal the stream, save it, run it through a hex editor, while watching it draw in a separate window. It got to be just a work of wonder what people came up with, and then my friend got an Amiga, and those splash screens... omg...

Re: Inspect ANSI control codes and escape sequences

#40
post #4

The revealing shibboleth is when people call it "ANSI". (-: "ANSI" is what people call it when they are working from paltry and incomplete samizdat doco of how this stuff works, from Microsoft's old ANSI.SYS appendix to its MS-DOS user manual, to innumerable modern WWW sites all repeating received wisdom. The thing to remember is that the "E" in "ECMA" does not stand for "ANSI". * https://ecma-international.org/publi…

Ill never forget the comments in termcap: "Brain dead", "Very Brain dead" and "Brain? What brain!" I think most of that was terminals that CTEOL Clear to end of line was just garbage.

We just knew that at some point in time, all the Hazeltine terminals were going to end up in the garbage, which is what they deserved, and no one would rescue them.

https://www.shallowsky.com/linux/noaltscreen.html

The parent post is SOLID GOLD.

Post reply on HN