A stray "j" ruined my evening
35 points
4 days ago
| 6 comments
| napkins.mtmn.name
| HN
Cyykratahk
2 hours ago
[-]
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.
reply
TRiG_Ireland
55 minutes ago
[-]
On seeing just the title, before reading the article, I assumed it was about the Wingdings J.
reply
geerlingguy
1 hour ago
[-]
Seemed to be a common occurrence from Microsoft Outlook users.
reply
sevenseacat
1 hour ago
[-]
I remember discovering this in about 2010, and thought it was hilarious
reply
mike_hock
5 hours ago
[-]
> but in ANSI newline delimiter is translated as "j"

?

reply
ralferoo
5 hours ago
[-]
\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.

reply
randallsquared
3 hours ago
[-]
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.
reply
rgoulter
2 hours ago
[-]
> \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-...

reply
microgpt
1 hour ago
[-]
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.

reply
thaumasiotes
4 hours ago
[-]
> \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.

reply
mike_hock
4 hours ago
[-]
Yes, but piping output containing newlines into wl-copy does not result in j's in the clipboard.
reply
gucci-on-fleek
2 hours ago
[-]
This comes up fairly often in TeX, where you can use ^^J to insert a newline character [0]. For example, the following code:

  \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

[1]: https://superuser.com/q/212874

[2]: https://en.wikipedia.org/wiki/Caret_notation

reply
raldi
1 hour ago
[-]
Yeah, I don't understand this. What broken tool is turning newlines into j?
reply
meindnoch
5 hours ago
[-]
So this is a bug in that Signal TUI he was using? I.e. it mangles newlines in pasted text.
reply
neonz80
4 hours ago
[-]
Impossible, Signal TUI is written in Rust.
reply
irishcoffee
1 hour ago
[-]
I can’t tell if this is sarcasm or not. I chuckled either way.
reply
baruchel
5 hours ago
[-]
reply
benj111
5 hours ago
[-]
I like how -j fixed the stray j problem....
reply
rav
4 hours ago
[-]
Today I learned that jq -Rrj is a shorter command line for doing the same as tr -d '\n'.
reply
stouset
1 hour ago
[-]
IIRC you don’t even need the -r flag since -j incorporates its behavior (minus newlines).
reply
weare138
40 minutes ago
[-]
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
reply