<font face="Wingdings">J</font>
Which renders as a smiley face. echo -e "test\n" | wl-copy
wl-paste \message{before ^^J after}
prints the following message: before
after
This is common in other old software too [1] [2], but TeX is where I see it the most often these days.[0]: https://tex.stackexchange.com/a/64848/270600
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.
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.
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?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.
The same 'j' as vi uses for 'hjkl'. https://vi.stackexchange.com/questions/42426/why-did-vi-use-...
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.
In the stone age, pressing CTRL flipped that bit, so ^J is literally "ctrl-J".
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)
If terminfo database is to be believed, quite a lot of other terminals reused this control sequences too, for some reason.
β back 2026-06-08
Some time ago I decided to wrangle a silly link shortener that I called shirts linkener, shirts for short.
There's nothing special about it in particular, rather it's in my run-once-forget-forever shell script that copies the generated links to a clipboard using wl-clipboard.
#!/bin/sh
shirt=$(curl -s -X POST "$(pass show shirts/url)" \
-H "Authorization: Bearer $(pass show shirts)" \
-H "Content-Type: application/json" \
-d "{\"url\": \"${1?missing url}\"}")
echo "$shirt" | jq
echo "$shirt" | jq -r '.short_url' | wl-copy
Nothing out of the ordinary here. It shortens the link and copies it to a clipboard. By then I have been hapilly using it for couple of months without an issue.
The fun began when I decided to try out gurk, a Signal TUI written in Rust. Those who know me, know my obsession with terminal interfaces so this was an obvious match.
One evening I was sharing a link to an image hosted on S3 when I noticed people were saying it shows 404 to them.
After pasting the link into Firefox, it worked. What is going on? I send them the link and it works now...
Time passes and I get the same responses from multiple friends - 404. After some time looking at the messages I notice a pattern - each url ends with "j".
Turns out I was copying the link with a \n at the end, which in most cases went unnoticed, but in ANSI newline delimiter is translated as "j", hence the stray jay at the end of each link.
After having a solid five minutes of immense shame I found that jq has --join-output argument, which prevents exactly my case:
--join-output / -j:
Like -r but jq won't print a newline after each output.
Moral of this story is that terminals are fun and shooting myself in the foot repeatedly acts as a great learning opportunity.
Some of the sources around control codes and escape sequences.
m.