Logo Search packages:      
Sourcecode: wapiti version File versions  Download package

def BeautifulSoup::PageElement::toEncoding (   self,
  s,
  encoding = None 
) [inherited]

Encodes an object to a string in some encoding, or to Unicode.
.

Definition at line 337 of file BeautifulSoup.py.

00337                                           :
        """Encodes an object to a string in some encoding, or to Unicode.
        ."""
        if isinstance(s, unicode):
            if encoding:
                s = s.encode(encoding)
        elif isinstance(s, str):
            if encoding:
                s = s.encode(encoding)
            else:
                s = unicode(s)
        else:
            if encoding:
                s  = self.toEncoding(str(s), encoding)
            else:
                s = unicode(s)
        return s

class NavigableString(unicode, PageElement):


Generated by  Doxygen 1.6.0   Back to index