Fixing a Chrome dictionary issue

A technical description of fixing a browser bug and contributing to Chrome’s codebase

The problem

At Medium, we want to give writers the best typography possible. Among many other things, in our editor — now, editors! — we change dumb quotes to smart quotes. Unfortunately, earlier this year, we discovered that words with smart quotes were flagged as incorrect in Chrome for Windows:

Image for post
Image for post

Installing and compiling Chromium

Since the issue only manifested itself on Windows or Linux, I grabbed a virtual machine with Windows 7 and Visual Studio 2013 Professional.

First intermediate goal

Instead of immediately attacking the biggest problem, I decided to start with two smaller tasks. This way I’d know incrementally what works and what doesn’t.

Image for post
Image for post
Image for post
Image for post
E:\src\third_party\hunspell_dictionaries>\src\out\Debug\convert_dict.exe en_US
Reading en_US.aff ...
Reading en_US.dic ...
Reading en_US.dic_delta ...
Serializing...
Verifying...
Writing en_US.bdic ...
E:\src>copy third_party\hunspell_dictionaries\en_US.bdic out\Debug\Dictionaries\en-US-4–0.bdic
E:\src>out\debug\Chrome
Image for post
Image for post

Second intermediate goal

Knowing that my changes are recognized, I then decided to add : (colon) as a valid alternative to the apostrophe. The reason I went with the colon was that it was within ASCII range, and I was afraid of Unicode encoding issues.

SET ISO8859-1
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
NOSUGGEST !
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
NOSUGGEST !
ICONV 1
ICONV : '
Image for post
Image for post

Actual goal

I then changed:

SET ISO8859-1
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
NOSUGGEST !
SET UTF8
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
NOSUGGEST !
ICONV 1
ICONV ’ '
Image for post
Image for post

Final steps

I put in an “upstream” PR in Wordlist (actually, Paul Irish did it for me), which was necessary because Chrome syncs with these dictionaries time and again.

git checkout -b mwichary-typographical-quotes
git add en_US.affgit commit -m "Smart/typographical quotes for en-US."git cl upload

Written by

Designer/typographer · Writing a book on the history of keyboards: https://aresluna.org/shift-happens

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store