6 ms·
Copy pasting code shared on slack, why do the apostrophe characters get converted into a different character that looks like an apostrophe?
by leovander 4y ago
Copy pasting code shared on slack, why do the apostrophe characters get converted into a different character that looks like an apostrophe?
- bombcar 4y agoOften it’s smart quotes or similar being stupid.
- thangalin 4y agoCurling smart quotes correctly is a deceptively hard problem. I implemented a basic natural language parser that does a decent job. However, straight quotes are ambiguous. Compounding the problem is that curled apostrophes and right single quotes are indistinguishable, which is an oversight in Unicode, IMO, because they are semantically different. Here's my swat at the puzzle: https://whitemagicsoftware.com/keenquotes/ https://whitemagicsoftware.com/keenquotes/ When exporting Markdown documents to HTML or PDF, my text editor uses KeenQuotes to curl straight quotes to their most likely candidate: https://github.com/DaveJarvis/keenwrite#download https://github.com/DaveJarvis/keenwrite#download
- GolDDranks 4y agoMakes it even harder that some languages use straigth quotes as the gold standard – so whether to curve them or not is language dependent.
- zokier 4y agoWhich languages prefer straight quotes? Wikipedia doesn't mention any: https://en.wikipedia.org/wiki/Quotation_mark https://en.wikipedia.org/wiki/Quotation_mark
- GoblinSlayer 4y agoLooks like hair splitting to me, they are all interchangeable. Apparently I used Dutch an Danish variants and nobody ever batted an eye. Cursive quotes look like just cursive version of straight quotes, you can't possibly differentiate them.
- bloak 4y agoQuotation marks arguably depend on the country more than on the language, so Switzerland quotes like «this» in French, German and Italian, while the Germans, at least, don't quote like that. It seems that Sweden and Finland use the same character for opening and closing quotes, like ”this”, which is similar to using straight quotes.
- GolDDranks 4y agoI was going to say "Finnish" (that's my native language), but to my surprise, after checking it, we use "”" after all. (We use that both as the opening and closing quotation mark.)
- jeroenhd 4y agoWhile I don't blame you or anything, this only works for English conventions. Dutch quotation marks are different, at least if you try to do smart quotes correctly. Expected output: „Goedemorgen,” zei hij. Returned output: “Goedemorgen,” zei hij. And that's just language to take care of! Smart quotes for computers are hell and there should be a library to do all this so everyone doesn't need to reinvent the wheel.
- P5fRxh5kUvp2th 4y agoThis was going to be my point (roughly). It's like when you travel and you start to judge gas stations by their bathroom. Anyone who has traveled a lot knows exactly what I mean. copy/paste worked more reliably 20 years ago than it does today. So much so that I've started judging software based upon their ability to reliably copy/paste. Seems stupid, right? Just like judging gas stations by their bathroom seems stupid to people who rarely go into them because they don't travel. But it flat out amazes me how bad copy/paste is today. I once spent _hours_ trying to figure out why a PHP script was shitting all over itself. It turns out I copy/pasted the email text from Monday.com and it copied non-printing characters that caused PHP to fall over. Thing is, at that point, I was an old hand at that stupid crap, it didn't take me that long to find it. I learned years ago not to trust copy/paste.
- bentcorner 4y agoIf you're on windows Ctrl+Shift+V is your friend.