Scrubbing Away Microsoft Smart Quotes - 04/05/2016

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

Previous comments on this post

Leave a Reply



(Your email will not be publicly displayed.)