'Handle character references as data.'

def handle_charref(self, ref):

    if self.convertEntities:
        if ref.lower().startswith('x'):
            ref = int(ref[1:], 16)
        try:
            data = unichr(int(ref))
        except ValueError:
            data = u''
    else:
        data = ('&#%s;' % ref)
    self.handle_data(data)
