About Unicode quotation marks

Dear eastgate,
Please forgive me for asking stupid questions.
The question is in the following passage:
“Getting Started With Tinderbox by Mark Bernstein”
p.47
Note that Tinderbox actions are case-sensitive,
and that rules use straight quotes ("), not typographic quotes (“”).

What is used here is “U+0027 APOSTROPHE” ['] written “twice”?
Or should I write “1” “U+022 QUATETION MARK” [ " ]?
From the font, it seems like one “U+022” is written.
Which UNICODE is officially required?
The reason I am confused is that “use straight quotes”
and quotes are written in plural.
Yours, WAKAMATSU
P.S
Reference site
[ASCII and Unicode quotation marks]
(ASCII and Unicode quotation marks)

In Tinderbox Action and Export code, only ‘straight’ single quotes (U+0027 APOSTROPHE) or ‘straight’ double quotes (U+0022 QUOTATION MARK) to delimit (i.e. mark the boundaries of) String-type data. So:

$MyString = 'hello';
$MyString = "hello";

Note that such quotes are always used in matched pairs. One type can enclose the other:

$MyString = "hello 'and' goodbye";

By convention but not a requirement, double quotes (U+0022) are the default usage where only one level of quote type is needed. A good example on using single (U+0027) quotes as he delimiters is when making a string of HTML code as HTML element attribute values require to be double quotes, e.g.:

$MyString = '<div class="blue">Test</div>';

IMPORTANT: In code typographic or ‘curly’ quotes characters are not treated as string delimiters.

Confusion arises as—by default—$Text, as with many writing tools, e.g. $TextEdit, automatically turns your typed straight quotes into the relevant equivalent typographic quotes for visual aesthetics. This is not least because there are no discrete keypad keys for typographic quotes and many user do not know the keyboard shortcuts need to create these characters.

In Tinderbox the $SmartQuotes system attributes controls this behaviour (by default is it true, i.e. it does allow auto-translation of characters. Note that the Tinderbox build in prototypes, Action, Code and HTML alter $smartQuotes to false exactly because such behaviour is unwanted when writing code.

†. These four characters are: U+2018 (LEFT SINGLE QUOTATION MARK), U+2019 (RIGHT SINGLE QUOTATION MARK), U+201C (LEFT DOUBLE QUOTATION MARK), U+201D (RIGHT DOUBLE QUOTATION MARK).

‡. Or tries to, using some OS-level logic. But, for instance an abbreviated date like '98 (for 1998)—here not altered by the forum Markdown as it only transposes paired quotes—will often be changed to ‘98 when by convention (in English) it should be ’98 (as the quote indicates the elision of the preceding ‘19’). so the software, tries to get the right typographic version but can fail. Don’t be surprised by this.

Dear Dr.Mark Anderson,
Thank you for your clear explanation.
Always use quotation marks in matching pairs.
I will pay particular attention to this.
“Automatically convert straight quotes to their aesthetically
relevant typographical equivalents.”
This explanation was also added,
which cleared up the confusion I had in my mind.

From the keyboard on Mac
U+0022 QUOTATION MARK "
I have found a way to input ‘U+0027 APOSTROPHE’.
On my keyboard (US Keyboard for Win)
For U+0027, press down on the part where “:” is engraved on the key,
and U+0027 “'” will be input when use the same key while pressing Shift,
U+0022 QUOTATION MARK will be entered.

However, the premise is that
OS System Preferences > Keyboard > User Dictionary >
We need to uncheck "Use smart quotes & dashes here ".

N.B : My environment is Mac OS 11.7.10 Big Sur
with FILCO US-keyboard
Yours, WAKAMATSU

1 Like

I fear I have no expertise with a Japanese keyboard layout. I do understand that typingb in a language (e.g. English) in a keyboard made for, or using a different locale (e.g. Japan) will couse headaches.

So, it is good you asked this question as I realise my answer above isn’t in aTbRef but really ought to be. I ewas gpoing to point you as a reference in aTbRef only to find the information wasn’t there. :smiling_face_with_tear: I’ll address that.

Meanwhile:

  • setting the OS setting may help in your case, e.g. in your more-than-one-language/locale scenario, but I don’t think it applies to everyone (thinking of other readers of this thread)
  • if in doubt, check the Unicode values of your quote characters. The OK ones are as listed above.

BTW, HUGE TIP: If you’re writing action code in a note, you’ll want to toggle $SmartQuotes to false. This tells Tinderbox NOT to convert straight quotes to curly quotes. It is set to false by default in action code authoring windows, HTML, and code prototypes and templates but not in other notes. This will come in handy.

This especially comes in handy if you’re writing a quick operation in a note with ^action()^ or if you’re pulling action code out of an $OnAdd to edit it

While I’m at it, if you set $SmartLinks to false, Tinderbox will NOT automatically convert the link to an HTML clickable link. This comes in handy when you’re writing in markdown. I’ve found that markdown link syntax, i.e., does not work in export when the URL is hyperlinked.

The character you want is

"
QUOTATION MARK
Unicode: U+0022, UTF-8: 22

As promised above, a new aTbRef page on different quote characters: Code: Straight vs. Typographic 'curly' quote characters.

1 Like