Loading...
Skip to content

Article

Techniques @ Bookhouse

Converting double quotes to single quotes

This article provides an overview of the process of converting double quotes to single quotes. Bookhouse has encapsulated this process into a software utility used in-house to produce localised editions of US books for Australian publishers.

If you’ve had a negative experience when someone has attempted this conversion for you in the past, this article may be of interest. It is understandable that someone may have attempted this for you and got it wrong – it seems like a simple process at first glance. There are a few nuances which make the conversion far from straightforward. Let’s take a closer look.

The first step is to isolate the apostrophes. Why is the apostrophe important? It’s all about the parts of US text which appear in single quotes – speech within speech – which need to be inverted to double quotes for the localised version. The complication is that, in typeset text, the apostrophe and closing single quote are the same character. It is necessary to isolate those apostrophes before we can convert single quotes to double quotes.

The apostrophes are replaced with a unique code. We use {0027}, which is similar to the way an apostrophe is represented in the Unicode system. It doesn't matter what the code is, as long as it is unique.

There are several places apostrophes may be found:

  • Contractions. The standard use of an apostrophe in contractions can be differentiated from other single quotes because it does not appear with any spaces around it. Search algorithms based on pattern-matching are used to target this precise condition.
  • Decades. The apostrophe may be used as a shorthand for decades – “the ’90s”. These can be distinguished from closing quotes because, unlike closing quotes, the space precedes them. Also, the apostrophe used in decade notation is followed by a number. Pattern-matching is used to target these specific conditions.
  • Plurals ending with ’s’. Pattern matching is not as simple in this situation, because normal quoted text may also end in ‘s’. The algorithm distinguishes them by looking for the circumstances where there is no accompanying opening quote.

The next step is an integrity check to confirm that all remaining single quotes appear in pairs. The algorithm checks that each opening quote is paired with a closing quote, without any other opening quotes in between.

From here on, the process is relatively straightforward.

The remaining single opening quotes are converted to a unique code, {2018}. The single closing quotes are converted to {2019}.

Then it is a simple search-and-replace from double opening quotes to single opening quotes, and double closing quotes to single closing quotes.

Then, {2018} is converted to double opening quote and {2019} to double closing quote.

Finally, {0027} is converted to apostrophe.

Voilà! Double quotes to single quotes.


We also have a complimentary translation table for US-to-AU spellings which handles much of the tedious work of localisation. This table can be modified by editorial prior to being used on the book, ensuring that house style is captured along with any words that may be distinct within the book.