Jens Oliver Meiert

Get 15% off on select books on Gumroad—use discount code â€śtestdrive”.

Apocryphal Apostrophes

Post from January 8, 2017 (↻ September 24, 2022), filed under and .

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 and str2 output the same string but str2 is easier to read since it doesn’t require an escape character in I'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

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead—currently manager for Developer Experience at LivePerson—and author. I’ve worked as a technical lead for Google, I’m close to W3C and WHATWG, and I write and review books for O’Reilly. I love trying things, sometimes including philosophy, art, and adventure. Here on meiert.com I share some of my views and experiences.

If you have a question or suggestion about what I write, please leave a comment (if available) or a message. Thank you!

Read More

Have a look at the most popular posts, possibly including:

Looking for a way to comment? Comments have been disabled, unfortunately.

Cover: The Web Development Glossary.

Get a good look at web development? Try The Web Development Glossary (2020). With explanations and definitions for literally thousands of terms from Web Development and related fields, building on Wikipedia as well as the MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.

Stay up-to-date? Learn about new posts by feed or on Twitter.

Found a mistake? Email me, jens@meiert.com.

You are here: Home → Archive → 2017 → Apocryphal Apostrophes

Last update: September 24, 2022

Professional frontend developers produce valid HTML and CSS.