Smart Quote Repair Script

This Perl script repairs documents that contain Microsoft's aggravating "smart quotes" and other nonportable character entities in HTML documents and messages. Greg Bacon posted it to Usenet on April 26, 2003.

#! /usr/local/bin/perl

use strict;
use warnings;

while (<>) {
    # 0x93 (147) and 0x94 (148) are "smart" quotes

    # 0x91 (145) and 0x92 (146) are "smart" singlequotes

    # 0x96 (150) and 0x97 (151) are emdashes

    # 0x85 (133) is an ellipsis
    s/\x85/. . ./g;


If your writing style is like mine, you may prefer to remove the spaces in the substituted text of the ellipsis substitution.

Chuck Taylor -- (Copyright) -- (Contact)