def unicode(self): a = self.attributes enc = encodings[a['encoding'].strip()] if not enc: log.warning('Unknown encoding: %s' % a['encoding']) raise AttributeError('unicode') return unicode(chr(a['char1'])+chr(a['char2']), enc)
def str(self): a = self.attributes enc = encodings[a['encoding'].strip()] if not enc: log.warning('Unknown encoding: %s' % a['encoding']) raise AttributeError('str') return str(chr(a['char1']) + chr(a['char2'])).encode(enc)