Live data from Hacker News

ASCII and Unicode quotation marks

cl.cam.ac.uk

41–50 of 195 posts

Re: ASCII and Unicode quotation marks

#41
The fact that ASCII does not have balanced quotes is one of the great catastrophes of computing. It makes everything more complicated than it needs to be, from embedding code in strings to parsing CSV files, to regexps. For example, if I want to embed a quoted string in another quoted string, I have to escape the inner quotes like so:

"This is string containing an embedded \"quoted\" string"

Then I have to think about whether or not the system I'm going to send that string to is going to "helpfully" remove the backslashes, in which case I need to write:

"This is a string containing an embedded \\"quoted\\" string"

God help you if you want to go two levels deep.

All this horrible complexity could have been avoided if we could just write:

«This is a string containing an «embedded» quoted string»

Alas.

Re: ASCII and Unicode quotation marks

#42

I'm pretty sure text like: ``quoted'' Is how you're supposed to write short quotes in the TeX/LaTeX typesetting system. [edit: My point being that the author seems to think this type of quoting originated with X11... which is actually newer than TeX (X11 was first released in 1984), and that the prevalence of this type of quoting likely originated with TeX when it was released in 1978... which isn't mentioned at all…

The author (Markus Kuhn) almost certainly knows about this (I assume based on his prolificness in publishing tech documents nearly 20 years ago). But the use of grave accent is sort of a different problem since it is merely the input to the TeX language that is then properly interpreted in a correct way. I do wonder about your story of X11, since although when X11 was released in 1984 LaTeX was not a thing and TeX did not have quite the widespread usage it did through the 90s. troff also uses grave accents for what it is worth.

Oh and see this article: https://www.cl.cam.ac.uk/~mgk25/ucs/apostrophe.html. It specifically mentions TeX.

Re: ASCII and Unicode quotation marks

#43
post #30

to add to the confusion: ' PRIME (U+2032) " DOUBLE PRIME aka inch mark (U+2033) have their own codepoints http://practicaltypography.com/foot-and-inch-marks.html which describes implications for typesetting coordinates and other things: 118° 19′ 43.5″ 118° 19’ 43.5” wrong (curly quotes, although it renders identical in some fonts) 118° 19' 43.5" right

Those should be added to the document, with a note that they are NOT quotes!

Re: ASCII and Unicode quotation marks

#44
post #39

Earlier quoted context omitted.

Well, since my keyboard doesn't have an mdash key, if there's no support for something like — or --- then I can't use mdashes.

If I need a special character, I find a web page or document that has it and use copy/paste.

Even then the character pallete built into MacOS is much more convenient for searching, saving, and inputting.

Re: ASCII and Unicode quotation marks

#45

I'm pretty sure text like: ``quoted'' Is how you're supposed to write short quotes in the TeX/LaTeX typesetting system. [edit: My point being that the author seems to think this type of quoting originated with X11... which is actually newer than TeX (X11 was first released in 1984), and that the prevalence of this type of quoting likely originated with TeX when it was released in 1978... which isn't mentioned at all…

That's because single quotes used to be rendered as a right single quote (as you might have in a contraction), and the backtick was angled much less aggressively. That is, it looked much more natural at the time.

Re: ASCII and Unicode quotation marks

#46
post #29

Earlier quoted context omitted.

In ASCII instead of combining marks what you have to do is write three characters: * The unaccented letter * The backspace character * The accent character If this makes no sense to you, try to imagine a literal, physical typewriter. Windows line terminators also work with a similar principle.

From what I recall from my childhood, physical typewriters worked slightly differently: the accent keys were non-advancing ("dead") keys. You pressed the "acute" key followed by the "e" key for an é, for instance. If you wanted a bare accent, you pressed the accent key followed by the space bar. (The typewriters I recall also didn't have a 0 or 1 key, you used uppercase O or I for these numbers.)

I believe that depended on the manufacturer and country convention. Most US keyboards didn't have an accent character. For example, here's one from the 1950s:

http://www.typewriters101.com/uploads/1/7/6/6/17660651/s7662...

For acute or umlaut you could use a + backspace + ' or u + backspace + " (or the opposite order). For grave or circumflex, I don't think there was a solution. Write it in by hand?

Re: ASCII and Unicode quotation marks

#47
post #41

The fact that ASCII does not have balanced quotes is one of the great catastrophes of computing. It makes everything more complicated than it needs to be, from embedding code in strings to parsing CSV files, to regexps. For example, if I want to embed a quoted string in another quoted string, I have to escape the inner quotes like so: "This is string containing an embedded \"quoted\" string" Then I have to think abou…

let's rewrite social idioms to use as quotes.

Re: ASCII and Unicode quotation marks

#48
post #41

The fact that ASCII does not have balanced quotes is one of the great catastrophes of computing. It makes everything more complicated than it needs to be, from embedding code in strings to parsing CSV files, to regexps. For example, if I want to embed a quoted string in another quoted string, I have to escape the inner quotes like so: "This is string containing an embedded \"quoted\" string" Then I have to think abou…

The complexity might be minimized, but not avoided. You would still need an escape mechanism for something like «She said «The \» key on the server doesn't work.»»

ASCII did add , [], and {}, any of which could have been used for quoted strings, had the programming language designers chosen that option.

https://en.wikipedia.org/wiki/String_literal#Paired_delimite... points out that PostScript and Tcl have a string literal which allows matched quotes.

  PostScript: (The quick (brown fox))
  Tcl: {The quick {brown fox}}

Re: ASCII and Unicode quotation marks

#49

It's worse for other languages. Russian quotation marks are « and ». Thanks to early computers being predominantly from/designed in the US, they are now highjacked by American quotes. Same probably goes for French and other languages with their own sets of quotation marks.

«Russian» quotation marks are actually the « French » ones with different spacing. There's another, less used set of quotes in Russian, so called „German“ ones (used as inner quotes and in handwriting). English quotes are widely accepted though.

Re: ASCII and Unicode quotation marks

#50
post #41

The fact that ASCII does not have balanced quotes is one of the great catastrophes of computing. It makes everything more complicated than it needs to be, from embedding code in strings to parsing CSV files, to regexps. For example, if I want to embed a quoted string in another quoted string, I have to escape the inner quotes like so: "This is string containing an embedded \"quoted\" string" Then I have to think abou…

If ASCII had balanced quotes then they would be used by programming languages to delimit strings and we would be back to square one with regards to escaping them!
Post reply on HN