Page 1 of 1

All "quotes" are not the same!

Posted: Wed Jan 15, 2020 6:00 pm
by sritcp
I drafted some code in TextEdit (a Mac editor) and copied to to the script of a button.
The code has several literals in quotes.
There was a compile error -- it didn't recognize the quote chars!
I deleted and added back the quote chars within LC script editor, and it worked.
The chars "quote", "beginning quote", and "end quote" seem to be three different things, and apps seem to encode the keystrokes differently.
You learn something new everyday, I guess!

Regards,
Sri

Re: All "quotes" are not the same!

Posted: Wed Jan 15, 2020 6:17 pm
by dunbarx
I had a project a couple of years ago where I wanted the "look" of quotes but not ASCII 34 (I ended up using ASCII 210). I did not want ordinary quotes, as they would have botched up my code.

is it possible that the original text used some form of "curly" quotes'?

Craig

Re: All "quotes" are not the same!

Posted: Wed Jan 15, 2020 6:36 pm
by sritcp
dunbarx wrote:
Wed Jan 15, 2020 6:17 pm
is it possible that the original text used some form of "curly" quotes'?
Craig
I pressed the same quote key on the keyboard, the one next to the enter/return key.
By the way, it was on a sticky note that I had scribbled the code (not in TextEdit).
I tested using nativeCharToNum in the message box:
The quote key pressed in LC returns 34.
The beginning and end quotes in sticky note (may be other Apple apps, too) return 210 and 211.
{Often, I construct bits of code when LC is not open; I use sticky note or TextEdit. I need to be careful!}

Regards,
Sri

Re: All "quotes" are not the same!

Posted: Wed Jan 15, 2020 7:26 pm
by FourthWorld
Most code editors use the actual key for what you get, 0x34. Some word processors and other tools designed for non-code tasks will have a feature called something like "Smart Quotes" which alters the key to become typographical quotes, as you've found.

If you want to code in non-coding tools, you'll usually find an option in the app's prefs to let you turn off "Smart Quotes".

Re: All "quotes" are not the same!

Posted: Wed Jan 15, 2020 7:39 pm
by richmond62
This is because of something called 'smart quotes.'

The basic quote at Decimal 34, Hex 22 in ASCII/Unicode:
-
quotes.png
-
is replaced by either:

U+201C (Decimal 8220) leading quote

or

U+201D (Decimal 8221) finishing quote:
-
quotesTWO.png
On English operating systems: operating systems running in other languages may vary:

https://en.wikipedia.org/wiki/Quotation_mark

https://practicaltypography.com/straigh ... uotes.html

Re: All "quotes" are not the same!

Posted: Wed Jan 15, 2020 8:38 pm
by sritcp
Smart quotes !
And I can turn it off in preferences in TextEdit (not in Stickies, though)!
I must remember to look at the preferences of the apps I use (including LC).
I miss out on a lot of feature power by not doing that.

Thanks, everyone!

Sri