'Changes a MS smart quote character to an XML or HTML
entity.'

def _subMSChar(self, match):

    orig = match.group(1)
    sub = self.MS_CHARS.get(orig)
    if (type(sub) == types.TupleType):
        if (self.smartQuotesTo == 'xml'):
            sub = (('&#x'.encode() + sub[1].encode()) + ';'.encode())
        else:
            sub = (('&'.encode() + sub[0].encode()) + ';'.encode())
    else:
        sub = sub.encode()
    return sub
