예제 #1
0
 def encode(self, text, tencoding='utf-8'):
     if not isinstance(text, unicode):
         raise Exception('text must be unicode, get %s' % type(text))
     utext = stringPartQ2B(text)
     return utext.encode(tencoding)
예제 #2
0
def extract_value(xpathnode, encoding='utf-8'):
    value = ''.join(xpathnode.extract())
    return stringPartQ2B(value).encode(encoding)