5 ms·
A stray "j" ruined my evening
- benj111 4mo agoI like how -j fixed the stray j problem....
- mike_hock 4mo ago> but in ANSI newline delimiter is translated as "j" ?
- ralferoo 4mo 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.
- thaumasiotes 4mo 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.
- mike_hock 4mo agoYes, but piping output containing newlines into wl-copy does not result in j's in the clipboard.
- randallsquared 4mo agoSome 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.
- rgoulter 4mo 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-hjkl-instead-of-jikl/42428#42428 https://vi.stackexchange.com/questions/42426/why-did-vi-use-...
- microgpt 4mo agoalso 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.
- rgoulter 4mo ago> 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)
- microgpt 4mo agoand did they choose that code because the J key had a down arrow printed on it?
- ahazred8ta 4mo agoNo, 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 https://en.wikipedia.org/wiki/Baudot_code
- kps 4mo agoOther 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.
- gucci-on-fleek 4mo agoThis 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 https://tex.stackexchange.com/a/64848/270600 [1]: https://superuser.com/q/212874 https://superuser.com/q/212874 [2]: https://en.wikipedia.org/wiki/Caret_notation https://en.wikipedia.org/wiki/Caret_notation
- raldi 4mo agoYeah, I don't understand this. What broken tool is turning newlines into j?
- fsckboy 4mo agothe 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.
- mike_hock 4mo agoInteresting 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?
- zahlman 4mo agoI 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.
- meindnoch 4mo agoSo this is a bug in that Signal TUI he was using? I.e. it mangles newlines in pasted text.
- neonz80 4mo agoImpossible, Signal TUI is written in Rust.
- irishcoffee 4mo agoI can’t tell if this is sarcasm or not. I chuckled either way.
- baruchel 4mo agohttps://zippythepinhead.com/Merchant2/merchant.mv?Screen=PROD&Product_Code=28-Sept-98&Category_Code=s1998&Product_Count=23 https://zippythepinhead.com/Merchant2/merchant.mv?Screen=PRO...
- Cyykratahk 4mo agoA 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.
- geerlingguy 4mo agoSeemed to be a common occurrence from Microsoft Outlook users.
- sevenseacat 4mo agoI remember discovering this in about 2010, and thought it was hilarious
- TRiG_Ireland 4mo agoOn seeing just the title, before reading the article, I assumed it was about the Wingdings J.
- weare138 4mo agoI 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
- zelon88 4mo agoIf 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.
- Getchowned 4mo ago[dead]
- cozzyd 4mo agoAs a vim user, stray J's are a fact of life.