alt.hn

6/23/2026 at 9:56:33 PM

A stray "j" ruined my evening

https://napkins.mtmn.name/posts/stray-jay.html

by birdculture

6/28/2026 at 12:23:02 PM

A stray "J" I encountered years ago: a certain client's support tickets would often end with a single "J", which was a little confusing as it was not one of their name initials. After a brief investigation, the original email source contained this:

    <font face="Wingdings">J</font>
Which renders as a smiley face.

by Cyykratahk

6/28/2026 at 1:46:11 PM

On seeing just the title, before reading the article, I assumed it was about the Wingdings J.

by TRiG_Ireland

6/28/2026 at 1:20:39 PM

Seemed to be a common occurrence from Microsoft Outlook users.

by geerlingguy

6/28/2026 at 1:23:09 PM

I remember discovering this in about 2010, and thought it was hilarious

by sevenseacat

6/28/2026 at 9:25:23 AM

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

?

by mike_hock

6/28/2026 at 9:33:56 AM

\n is ^J (ctrl-J) so there's some logic there, but I wonder if something has been lost in the message. I'd guess it either displays ^J or an inverse-colour J, rather than just a plain lowercase j.

Also possible that the j is a red herring and just some random character that's always there. Pasting a URL containing a newline into most browsers just truncates it at the newline, regardless of how much text is after. I only know this from occasionally copying links from a terminal window where the copy somehow added newlines every 80 characters (even though copying this way normally works fine). I'd have to copy the URL with newlines into a text editor, remove the new lines and copy again to be able to paste it.

by ralferoo

6/28/2026 at 11:46:28 AM

> \n is ^J (ctrl-J) so there's some logic there

The same 'j' as vi uses for 'hjkl'. https://vi.stackexchange.com/questions/42426/why-did-vi-use-...

by rgoulter

6/28/2026 at 12:51:09 PM

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.

by microgpt

6/28/2026 at 3:23:18 PM

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.

by kps

6/28/2026 at 8:13:11 PM

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.

by Joker_vD

6/28/2026 at 3:20:08 PM

> 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)

by rgoulter

6/28/2026 at 4:48:36 PM

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

by microgpt

6/28/2026 at 2:51:54 PM

No, it's ^J because `J` is 0x4A in ASCII and `\n` is 0x0A, just as `I` is 0x49 and `\t` (tab, ^I) is 0x09.

In the stone age, pressing CTRL flipped that bit, so ^J is literally "ctrl-J".

by snarkconjecture

6/28/2026 at 3:21:49 PM

You're saying the same thing. vi uses ‘j’ because the ADM-3A printed ‘­­↓’ on the ‘­J’ key because Control-J is newline because the code is J with a bit flipped because bit-flipping was practical on an electromechanical teletype.

by kps

6/28/2026 at 11:26:06 AM

Some tool or library is interpreting the newline as two characters (as you note), and then a subsequent step is removing unprintable characters. Things like this used to frequently happen in shells, Perl, PHP, and so on.

by randallsquared

6/28/2026 at 9:43:48 AM

> \n is ^J (ctrl-J) so there's some logic there

Specifically, J is the 10th letter of the alphabet and therefore ctrl-J is code for ascii 10. Same reason ctrl-D sends EOF and ctrl-I sends tab.

by thaumasiotes

6/28/2026 at 10:12:21 AM

Yes, but piping output containing newlines into wl-copy does not result in j's in the clipboard.

by mike_hock

6/28/2026 at 1:15:45 PM

Yeah, I don't understand this. What broken tool is turning newlines into j?

by raldi

6/28/2026 at 4:14:50 PM

I thought it was a strange way to express the problem, too. OP didn't really explain where or how the clipboard text was getting pasted in order to reproduce the issue.

by zahlman

6/28/2026 at 3:33:40 PM

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, take the J with the rest of the escape sequence at whatever layer is doing this.

  ESC[J   erase in display (same as ESC[0J)
  ESC[0J  erase from cursor until end of screen
  ESC[1J  erase from cursor to beginning of screen
  ESC[2J  erase entire screen
  ESC[3J  erase saved lines
ASCII and then ANSI were invented as in-band communications and terminal control protocols, not "file formats". You thread filters together like beads on a string, where ASCII is somebody's job, and ANSI is somebody's job, and then the rendered text is presented to the user.

unix is ingenious how it has accomodated changes and conflicting ideas, incorporating the new squoze next to the old, like UTF-8 because the same people did that. It's not perfect, but it proved "worse is better" because it for a long time it outcompeted its alternatives and never became bloated and overburdened by bureaucratic committee ideas.

however today's developers did not "come up" in the same culture of apprenticeship learning so a lot of the clever subtlety has been lost and now worse is starting to be worse, and guess what, there is no better.

by fsckboy

6/28/2026 at 3:02:23 PM

If it's any consolation, the other day I spent 3 hours diagnosing a homebrew circuit board for no signal and finally realized the Raspberry Pi sending the signal had a dead GPIO pin.

by zelon88

6/28/2026 at 9:30:48 AM

So this is a bug in that Signal TUI he was using? I.e. it mangles newlines in pasted text.

by meindnoch

6/28/2026 at 10:17:19 AM

Impossible, Signal TUI is written in Rust.

by neonz80

6/28/2026 at 1:05:37 PM

I can’t tell if this is sarcasm or not. I chuckled either way.

by irishcoffee

6/28/2026 at 3:52:50 PM

As a vim user, stray J's are a fact of life.

by cozzyd

6/28/2026 at 9:20:38 AM

I like how -j fixed the stray j problem....

by benj111

6/28/2026 at 10:18:12 AM

Today I learned that jq -Rrj is a shorter command line for doing the same as tr -d '\n'.

by rav

6/28/2026 at 1:07:56 PM

IIRC you don’t even need the -r flag since -j incorporates its behavior (minus newlines).

by stouset

6/28/2026 at 2:01:48 PM

I was poking around with this and I noticed wl-copy has an option to trim newlines. Maybe that's why they added the option but I'm leaning towards gurk being the culprit. wl-copy itself seems to handle newlines ok, at least for me. This works as expected:

  echo -e "test\n" | wl-copy

  wl-paste

by weare138

6/28/2026 at 3:23:21 PM

[dead]

by Getchowned