Apocryphal Apostrophes
Published on Jan 8, 2017 (updated Jul 1, 2023), filed under design, development. (Share this post, e.g., on Mastodon.)
This is one of 180 articles that you can also read in an ebook: On Web Development II.
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.";
str1andstr2output the same string butstr2is 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 an 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 an engineering lead, guerrilla philosopher, and indie publisher. I’ve worked as a technical lead and engineering manager at various companies (e.g., Google); I’m an active web and tool developer (code optimization, digital defense), a contributor to web standards (like HTML, CSS, WCAG), and a book author (O’Reilly, Frontend Dogma).
I love trying things—in web development and engineering management, but also in politics and philosophy, where I hold to one idea in particular: that we can only be well if we take good care of everyone. Here on meiert.com I talk about some of my perspectives and experiences. (Interpret charitably but be critical—and share feedback and advice that makes my work better.)
