More Than Just Web Design | INTERNET ENGINEERING | APPLICATION | DESIGN

Scrubbing Away Microsoft Smart Quotes

Posted: 04/05/16

Microsoft "smart" quotes can be anything but. Let's scrub them clean with a little Vim.

I tend to do a lot of data mangling. Occasionally I trip over text that has been tainted with Microsoft Office and is infested with their so-called "Smart" quotes. These little nasties tend not to play nice with some importers. Fortunately, they can be scrubbed clean with a little Vim

Using the Vim editor, smart quotes etc tend to show up as <91> <92> etc. A global search and replace will clean them up nicely:

:%s/[\x91\x92]/'/g

A similar rule will work for single quotes/apostrophes, and hyphens:

:%s/[\x93\x94]/"/g
 
:%s/[\x96]/-/g