Live data from Hacker News

A stray "j" ruined my evening

napkins.mtmn.name

31–36 of 36 posts

Re: A stray "j" ruined my evening

#32

Earlier quoted context omitted.

also the same 'j' found in words like 'jujuism', 'jejunities', and 'bejeezus', also by a magical coincidence the same one in most Latin fonts, and even some random text strings such as 'pj$4' But I suppose you're saying ASCII 10 was chosen as newly because it aligns with the down arrow on keyboards of the time. Maybe.

> I suppose you're saying ASCII 10 was chosen as newly because it aligns with the down arrow on keyboards of the time. Maybe. The linked StackExchange has it as: > What character was used for what control code was mostly a matter of bitwise arithmetics. LF is ^J because J happens to be at the corresponding location in the corresponding column of the table (+ 64 in decimal)

and did they choose that code because the J key had a down arrow printed on it?

Re: A stray "j" ruined my evening

#33
post #27

Earlier quoted context omitted.

also the same 'j' found in words like 'jujuism', 'jejunities', and 'bejeezus', also by a magical coincidence the same one in most Latin fonts, and even some random text strings such as 'pj$4' But I suppose you're saying ASCII 10 was chosen as newly because it aligns with the down arrow on keyboards of the time. Maybe.

Other way around. ASCII classified control characters into blocks and newline ended up a bit-flip away from J, so the ADM-3A printed ‘­↓’ on the ‘­J’ key.

Yes, and ADM-3A also had "↑" on the "K" key, because \013 is vertical tabulation (VT), and "→" on the "L" because \014 is form feed (FF). It all makes perfect sense.

If terminfo database is to be believed, quite a lot of other terminals reused this control sequences too, for some reason.

Re: A stray "j" ruined my evening

#34
post #27

Earlier quoted context omitted.

Other way around. ASCII classified control characters into blocks and newline ended up a bit-flip away from J, so the ADM-3A printed ‘­↓’ on the ‘­J’ key.

Yes, and ADM-3A also had "↑" on the "K" key, because \013 is vertical tabulation (VT), and "→" on the "L" because \014 is form feed (FF). It all makes perfect sense. If terminfo database is to be believed, quite a lot of other terminals reused this control sequences too, for some reason.

In the era when video terminals were new I have to guess that K and L were just plausibly related enough to justify using them for additional cursor motions, after H and J fit exactly.

Re: A stray "j" ruined my evening

#35

Earlier quoted context omitted.

> I suppose you're saying ASCII 10 was chosen as newly because it aligns with the down arrow on keyboards of the time. Maybe. The linked StackExchange has it as: > What character was used for what control code was mostly a matter of bitwise arithmetics. LF is ^J because J happens to be at the corresponding location in the corresponding column of the table (+ 64 in decimal)

and did they choose that code because the J key had a down arrow printed on it?

No, the Baudot / Western Union mechanical teletype code assignments were worked out in the late 1800s and early 1900s. This was later developed into ASCII. Computer keyboards came much later. https://en.wikipedia.org/wiki/Baudot_code

Re: A stray "j" ruined my evening

#36
post #29

> but in ANSI newline delimiter is translated as "j" ?

the ANSI escape sequences for screen erasing start with ESC and end in J. When you display a string on a screen including a newline at the end of it, you need to erase to the end of the line on the screen so you don't leave predecessor garbage which would be confusing. That's how the J got inserted, then whatever is processing this is swallowing the rest of the escape sequence but leaving the J. The fix is there, tak…

Interesting hypothesis. What makes it somewhat implausible is the fact that he got lower-case j's.

Also,

    echo '{"foo":"bar"}' | jq -r '.foo' | xxd -p
gives me

    6261720a
(i.e. bar\n), so I don't quite see how he could have gotten j's (or J's for that matter) injected into that pipeline. Maybe with some weird/broken locale settings?
Post reply on HN