Live data from Hacker News

ASCII and Unicode quotation marks

cl.cam.ac.uk

141–150 of 195 posts

Re: ASCII and Unicode quotation marks

#141

I hate the "" -> “” thing with a passion. I don't know how much productivity that the world has lost with that “” shit. It doesn't look that much better, and it always fucks with me at random times. That shit is on the list of annoying problems that shouldn't exist in the first place, along with the \nl\cr thing, and the txt saved as rtf thing, and the UTF-8 encoding-character-at-the-beginning-of-the-file or whatever…

> at-the-beginning-of-the-file That thing's the BOM.

Which you don't really need with UTF-8, it only has a purpose for UTF-16+.

Re: ASCII and Unicode quotation marks

#142

What bothers me about Unicode isn't that apostrophe (U+0027) is overloaded by having two semantic meanings ("apostrophe" or "single straight quote"), but that they exacerbate the confusion by recommending to overload "right single quote" (U+2019) to also mean apostrophe. We now have two characters for apostrophe and extra ambiguity for processing correct right single quotes. Great job not breaking historical document…

And now, imagine that your own name has an apostrophe in it. Like my family name. I can tell you, I crashed many databases and in 90% of the cases where people need to find again my name in a database, it is ending up with requesting my address because each time a different character is put by the clerk doing the data entry and they cannot match my name. Even state level authorities are bad, really bad, at it.

Re: ASCII and Unicode quotation marks

#143
post #48

Earlier quoted context omitted.

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 li…

Ruby lets you use arbitrary tokens for string literals with %s{} (where the braces can be a bunch of things). I wish more languages would adopt this tbh.

Apache Groovy also had that in its early 1.0 betas but they were removed before their official 1.0 release party.

Re: ASCII and Unicode quotation marks

#144

Earlier quoted context omitted.

> then you should still stick to ASCII unless you have other good reasons to. Why? Using non-ASCII Unicode characters acts like a nice canary for detecting character encoding issues. Besides, why would I purposely limit my text to ASCII? It doesn't even suffice for English, let alone almost any other language I use ­— including my native language Dutch, German, and Japanese.

All sorts of reasons. Diagnostic printf message in some embedded firmware. Do you need to drag Unicode into it? Git log message. Ditto.

> Diagnostic printf message in some embedded firmware. Do you need to drag Unicode into it?

Why not? The firmware itself would usually have no reason to care about the details of a diagnostic message's encoding, whether that be ASCII or UTF-8 - it can mostly just treat strings as bags of bytes. There might be some byte values that are special (nul terminator, % for printf, etc.), but UTF-8 is a superset of ASCII and represents extended characters using only bytes with the highest bit set, so there will never be 'false positives' of the special byte values. Other than that, the bytes can stay uninterpreted as they go over whatever serial port or diagnostic protocol the device is using, until they eventually show up on - most likely - some sort of terminal application on a modern computer, which probably supports UTF-8 already. So in most cases it should 'just work'.

Of course, there are situations where it won't just work, such as if the firmware needs to display the diagnostic message on a screen (by itself), but from what I've seen those are the minority.

edit: As for Git, what's wrong with people writing log messages in their language of choice? (Other than the social issue of it making it harder for English speakers to use the codebase.)

Re: ASCII and Unicode quotation marks

#145
post #48

Earlier quoted context omitted.

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 li…

Ruby lets you use arbitrary tokens for string literals with %s{} (where the braces can be a bunch of things). I wish more languages would adopt this tbh.

C++ has something similar.

Re: ASCII and Unicode quotation marks

#146
post #28

Earlier quoted context omitted.

It doesn't need to. You can put the mdash directly in comments: — As opposed to regular dash: -

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.

I'm using AutoHotKey on Windows. Not only for this, but for other things, as well.

For example (! means the AltGr key):

  !4::Send „
  !5::Send “
  !2::Send ‚
  !3::Send ‘
  !+6::Send “
  !+7::Send ”
  !+8::Send ‘
  !+9::Send ’
  !-::Send –
  !.::Send …
Also to use Caps Lock as another Control key:

  Capslock::Ctrl
Or make windows stay on top of others, if even they lose focus:

  !t::Winset, Alwaysontop, TOGGLE, A

Re: ASCII and Unicode quotation marks

#147

Earlier quoted context omitted.

> at-the-beginning-of-the-file That thing's the BOM.

Which you don't really need with UTF-8, it only has a purpose for UTF-16+.

It's useful to tell a text editor "This is UTF-8, not Windows-1252 or ISO-8859-1 or whatever you might be used to".

Re: ASCII and Unicode quotation marks

#148

Earlier quoted context omitted.

Linux users should enable the compose key, it's very useful. Test it with: setxkbmap -option compose:menu Then press the menu/compose key (next to right control), then C, then =. You get €. Try compose, 1, 2 for ½. Compose, ^, 3 for ³. Compose, A, : for Ä. It's pretty intuitive for the most useful characters, and easily the fastest way I have of typing the ö, ñ and å in various colleagues' names.

Worth noting that international layouts (with dead keys) support many of those without the use of compose key (for obvious reasons not your first example – but the € symbol has its own key combination at least where it's commonly used). I admit it might be hard to adjust to caret being a dead key, though.

Dead keys support accents, and a few symbols printed on the keyboard are discoverable, but I find the Compose key is much more intuitive for occasional use.

I don't yet speak the language of my adopted country, so it's better for me to keep []{} etc where I like them in the British layout, and use three keypresses for typing the ø in a (place) name like København.

If I do end up typing lots of Danish, I'll probably map AltGr+A,E,O to Å, Æ, Ø. É is rare, so I'll still use the Compose key for that and German / Swedish names.

Re: ASCII and Unicode quotation marks

#149
post #48

Earlier quoted context omitted.

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 li…

Ruby lets you use arbitrary tokens for string literals with %s{} (where the braces can be a bunch of things). I wish more languages would adopt this tbh.

C++11 has this feature too [1], e.g.:

    const char * str = R"*^*(This is string containing an embedded "quoted" string)*^*";
[1] http://en.cppreference.com/w/cpp/language/string_literal

Re: ASCII and Unicode quotation marks

#150

Earlier quoted context omitted.

Which you don't really need with UTF-8, it only has a purpose for UTF-16+.

It's useful to tell a text editor "This is UTF-8, not Windows-1252 or ISO-8859-1 or whatever you might be used to".

No, just do 8-bit clean, don't SCREW with the encoding if you weren't asked to.
Post reply on HN