Apocryphal Apostrophes
Published on January 8, 2017 (↻ July 1, 2023), filed under Development and Design (RSS feed for all categories).
For JavaScript, W3Schools (caution) says:
The backslash escape character turns special characters into string characters:
var x = 'It\'s alright';
Same for my darling Enki, noting:
str1 = 'I\'m a string.; str2 = "I'm a string.";
str1
andstr2
output the same string butstr2
is easier to read since it doesn’t require an escape character inI'm
.
For Python, Learn Python the Hard Way says:
[…]you escape double-quotes and single-quotes so Python knows to include in the string. Here’s an example:"I am 6'2" tall." # escape double-quote inside string 'I am 6\'2" tall.' # escape single-quote inside string
For Oracle PL/SQL, Tech on the Net says:
When the apostrophe/single quote is in the middle of the string, you need to enter [two] single quotes for Oracle to display a quote symbol. For example:
SELECT 'He''s always the first to arrive'
(This could go on.)
The examples aren’t perfect, the sources, neither, but what’s wrong in this picture?
What’s wrong is what typographers preach for ages: Use real apostrophes.
(On macOS with US keyboard layout you should be able to type a apostrophe through option + shift + ]. On Windows, use something like alt + 0146.)
Yes, we’ll still need to escape characters—perhaps the examples simply aren’t great—and tutorials to say how to. But our designs benefit from proper punctuation, and so does our code.
See the punctuation cheat sheet for more characters to use correctly, in more locales.
About Me
I’m Jens (long: Jens Oliver Meiert), and I’m a frontend engineering leader and tech author/publisher. I’ve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, I’m a contributor to several web standards, and I write and review books for O’Reilly and Frontend Dogma.
I love trying things, not only in web development (and engineering management), but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (Please be critical, interpret charitably, and give feedback.)
Read More
Maybe of interest to you, too:
- Next: On Quality and Logistics
- Previous: CSS Shorthand Syntax Considered Important
- More under Development or Design
- More from 2017
- Most popular posts
Looking for a way to comment? Comments have been disabled, unfortunately.
Get a good look at web development? Try WebGlossary.info—and The Web Development Glossary 3K. With explanations and definitions for thousands of terms of web development, web design, and related fields, building on Wikipedia as well as MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.