5 ms·
What's old is new again. People who use the wrong tools produce data in the wrong format. You used to get people writing web pages in Microsoft Word, a tool de
by amiga386 2y ago
What's old is new again. People who use the wrong tools produce data in the wrong format.
You used to get people writing web pages in Microsoft Word, a tool designed for human prose, and so has "smart quotes" on by default, hence they write:
<div class=“a b c d”>
which is parsed as:
<div class="“a" b="" c="" d”="">
because smart quotes aren't quotes. The author used the wrong tool for composing text. They should have used a text editor.
I also find that even people in text editors sometimes accidentally type some combination that is invisibly wrong, for example Option+Space on macOS is a non-breaking space (U+00A0) rather than regular space (U+0020) and that's quite easy to type accidentally, especially If You're Adding Capitals because shift and option are pretty near each other.
Sometimes people also manage to insert carriage returns and/or linefeeds in what's supposed to be a single-line input value, so regular expressions using "." to match anything don't go beyond the first newline unless you turn on the "multiline" flag.
None of this is unicode specifically, it's just the age old problem of human ingenuity in providing nonstandard data, and whether _you_ do workarounds to fix it, or you make the supplier fix it.
- euroderf 2y agoSmart quotes are the work of the Devil.
- oneeyedpigeon 2y ago> The author used the wrong tool for composing text. They should have used a text editor. Then you have the opposite problem: most text editors make it non-trivial to work with unicode. I mean, I've taken the time to learn how to type curly quotation marks vs. straight ones, but not everyone has and keyboards don't make it easy.
- pavel_lishin 2y agoMay I ask why you use curly quotation marks instead of the straight ascii ones?
- oneeyedpigeon 2y agoIn written text, I think they're far more attractive. If I need to put forward some kind of 'objective' argument, then differentiating between open and closed seems to make logical sense. Check out any printed material: 99.9% of the time, it uses curly quotes.
- verandaguy 2y agoMy mental framework has been: - Curly quotes are a typographic sugar that's easier on the human eye when reading normal, human-language text. It's reasonable for them to be automatically inserted into your typing in something like a word processor, and depending on which language you're writing in, there may be strong orthographic rules about the use of curly braces (or their cognates, like « guillemets », etc). - Straight quotes belong in code by a combination of convention and practicality; unicode characters should be escaped wherever it's practical to do so (for example, if you must use "→" in your code, prefer to do e.g. "\u2192" instead -- it's clearer for future users which exact unicode arrow you were using there).
- kragen 2y agoi have this problem a lot with markdown, because i very much do want my “” smart quotes in the formatted output, but markdown also (optionally) uses "" for link titles. i recently switched to using () for link titles, which i had forgotten was an option also i sometimes accidentally replace a " with “ or ”, or a ' with a ‘ or ’, inside of `` or an indented code block
- TheRealPomax 2y agonit: at the time they should have used an HTML editor. Those still existed back then.