Live data from Hacker News

Don't touch my clipboard

alexanderell.is

171–180 of 322 posts

Re: Don't touch my clipboard

#171
post #99

Earlier quoted context omitted.

Ok but those are standard, valid characters like any others. Why are they ‘horrid’?

Because for some reason terminals are stuck in the 70ies and don't accept those characters as quotes. Anything but ASCII trips them up. Seems such an obvious interface to innovate, but it seems to run into terminal wizards sense of purity.

The terminal can usually handle it, provided it's UTF-8. Most of the editors can handle it. It's very specifically the programming language specifications which don't include them. Even the ones that allow Unicode identifiers.

Also, they're difficult to type - my keyboard has a " key but not a “ or ” character. I had to copy and paste those from the unicode website since I don't have a suitable input method set up.

Re: Don't touch my clipboard

#172
post #99

Earlier quoted context omitted.

Because for some reason terminals are stuck in the 70ies and don't accept those characters as quotes. Anything but ASCII trips them up. Seems such an obvious interface to innovate, but it seems to run into terminal wizards sense of purity.

That seems like an obviously bad solution. That is like writing [a(b{c]d}e) except that the quote characters look even more similar.

Its easy (solved) to map Unicode to control characters such as quotes (and when you think about it, quotes are often there to deal with ambiguities stemming from the limited number of allowed characters in ASCII). So to could have a terminal accepting such input, and a few helper function that normalize it into ASCII and so on.

After all, users of non-ascii languages (which is nearly everyone) already know how to deal with it without ambiguity. Its only ambiguous if you don't use encodings, and that should never happen anyway.

Re: Don't touch my clipboard

#173
post #51

It's not just a browser thing. Apple Books does this with their e-books, which is infuriating if you're working with a coding book and just want to copy-paste stuff into your editor/terminal. You get something like: “ghci> putStrLn (pretty 10 value)” Excerpt From: Bryan O’Sullivan, John Goerzen, and Donald Bruce Stewart. “Real World Haskell.” Apple Books. When you only copied: ghci> putStrLn (pretty 10 value) Note th…

I remember that kind of thing as far back as Encarta(?) Back then, I was writing papers and it was kind of handy.

OneNote does this on the paste end, which is really nice for collecting references and quotes, as you get the source automatically.

Re: Don't touch my clipboard

#174
post #50

This happened to me recently and it was pretty embarassing - I copied a two paragraph snippet from a psychology paper and the website put an ad for CBD oil in my clipboard above the paragraphs. The segment I copied was just long enough that it overflowed my chat window so I had no idea the insertion was even there and I sent it as-is. The recipient called me about two minutes later and said "hey, I think you've been…

That's kind of hilarious actually. This highlights the tension between the document-web and the app-web. What if the page is an image editor, word processor, spreadsheet? These app-web pages need custom logic for copy and paste. Unfortunately, bad actors (like what you found) ensure browsers cannot implement this stuff properly, because every feature is now a way to shove a new ad in.

It is possible to allow websites to implement custom logic within them without letting them mess with copy & paste going out of these sites.

Re: Don't touch my clipboard

#175
post #148

Earlier quoted context omitted.

> aren't even the ASCII quote character; you get horrid unicode quotes Why should they be ASCII, and what’s wrong with Unicode?

Because the next step when you face this problem is doing a search-replace of the quotes to remove them. ASCII quotes are on your keyboard, so you can actually type the command to remove them. Unicode quotes probably aren't, so it's extra annoying to remove them, and they're not even the same character for start and end so you have to do it twice. The time spent for removal is then vastly higher than with ASCII quote…

PowerShell acknowledged smart quotes and dashes in its language design and allows proper quotes interchangeably with ASCII straight quotes. I always found that an interesting design choice, although I'm not sure how useful it actually is to allow people to copy/paste code from dubious web pages. On the other hand, they'll do that anyway, so why bother making it harder?

Re: Don't touch my clipboard

#176
post #74

The wrongest thing about this, from my perspective, is that my browser fires off a js 'copy' event when I press control-c. There are times when I've found it helpful that a browser can copy text to my clipboard when I click a button, but I can't think of a single time when I want a site to react to my attempt to copy text off if it. Is there any way to configure my user agent (Firefox) not to do this? A hack is ok.

Even that won't totally save you. While you can't do exactly this, you can sure get the fun experience of the user getting text they didn't expect in the clipboard when copying without any JS at all. Text is highlighted on the page based on the code order, not as it appears on-screen (at least in Firefox and Chrome). If you throw elements off-screen with some CSS, you can create a big disparity between what the user…

This works when you manually select the text, but it fails when you want to select by double-/triple-clicking. In this case the selection ends before the word “me”.

It’s awkward how easily one can break a basic functionality like select & copy.

Re: Don't touch my clipboard

#177
post #33

Most importantly, https://emdash.fan/ is the best emdash site on the internet.

My go-to site for copying special symbols is Wikipedia, which is, of course, well-behaved: Dashes https://en.wikipedia.org/wiki/Dash Diacritics https://en.wikipedia.org/wiki/Diacritic Precomposed Latin characters https://en.wikipedia.org/wiki/List_of_precomposed_Latin_char... Currency symbols https://en.wikipedia.org/wiki/Currency_symbol Japanese typographic symbols https://en.wikipedia.org/wiki/List_of_Japanese_typo…

Use the GNOME Character Map¹ program, or your local equivalent². Not everything needs to be a web site.

1. https://wiki.gnome.org/Apps/Gucharmap

2. https://wiki.gnome.org/Apps/Gucharmap#See_Also

Re: Don't touch my clipboard

#178

Earlier quoted context omitted.

Inserting ASCII quotes instead would result in exactly the same problem.

Not exactly the same. Since anything inside ASCII quotes is typically considered a valid string in most programming languages, if you delete everything after the final quotation mark you have a syntactically valid program. It won't do what you want, but it's not a syntax error. So unicode quotes and ASCII quotes are not exactly the same in this scenario.

They both break what you were trying to do, and the fact that they do it in slightly different ways really isn't worth making a long pedantic argument about.

Re: Don't touch my clipboard

#179
post #148

Earlier quoted context omitted.

> aren't even the ASCII quote character; you get horrid unicode quotes Why should they be ASCII, and what’s wrong with Unicode?

Because the next step when you face this problem is doing a search-replace of the quotes to remove them. ASCII quotes are on your keyboard, so you can actually type the command to remove them. Unicode quotes probably aren't, so it's extra annoying to remove them, and they're not even the same character for start and end so you have to do it twice. The time spent for removal is then vastly higher than with ASCII quote…

It's not changing quotes in the code. It is adding quotes. You have to delete them, not search-and-replace them, and it doesn't matter what kind of quotes they are, you have to do the exact same thing.

Re: Don't touch my clipboard

#180
post #50

This happened to me recently and it was pretty embarassing - I copied a two paragraph snippet from a psychology paper and the website put an ad for CBD oil in my clipboard above the paragraphs. The segment I copied was just long enough that it overflowed my chat window so I had no idea the insertion was even there and I sent it as-is. The recipient called me about two minutes later and said "hey, I think you've been…

That's kind of hilarious actually. This highlights the tension between the document-web and the app-web. What if the page is an image editor, word processor, spreadsheet? These app-web pages need custom logic for copy and paste. Unfortunately, bad actors (like what you found) ensure browsers cannot implement this stuff properly, because every feature is now a way to shove a new ad in.

That just demonstrates that ads are not web-specific, but actor-specific, so that adblock technology should work at the OS level^, like firewall and antivirus. This would shift the problem to bad adblock vendors, but at least we could have few okay-today options to choose from.

^ not gonna happen for most platforms, as it’s walled gardens all the way down, but hopefully some day it will become obvious that adcrap tech stack is a wrong foundation to make computers and their economy.

Post reply on HN