コード例 #1
0
ファイル: HTML.py プロジェクト: anarchivist/pyflag
    def innerHTML(self):
        """ charset is the desired output charset """
        result = u''
        for c in self.children:
            result += smart_unicode(c, encoding = self.charset[0])

        return result
コード例 #2
0
ファイル: HTML.py プロジェクト: johnmccabe/pyflag
    def innerHTML(self):
        """ charset is the desired output charset """
        result = u''
        for c in self.children:
            result += smart_unicode(c, encoding=self.charset[0])

        return result
コード例 #3
0
ファイル: HTML.py プロジェクト: anarchivist/pyflag
def url_unquote(string):
    def decoder(x):
        return x.group(1).decode("hex")

    ## we can use this to handle arbitrary levels of quoting
    try:
        string = re.sub("%(..)", decoder, string)
    except: pass
        
    ## references seem to _always_ be encoded using utf8 - even if the
    ## page is encoded using a different charset??? This whole quoting
    ## thing is very confusing.
    return smart_unicode(string, 'utf8')
コード例 #4
0
ファイル: HTML.py プロジェクト: johnmccabe/pyflag
def url_unquote(string):
    def decoder(x):
        return x.group(1).decode("hex")

    ## we can use this to handle arbitrary levels of quoting
    try:
        string = re.sub("%(..)", decoder, string)
    except:
        pass

    ## references seem to _always_ be encoded using utf8 - even if the
    ## page is encoded using a different charset??? This whole quoting
    ## thing is very confusing.
    return smart_unicode(string, 'utf8')
コード例 #5
0
ファイル: HTML.py プロジェクト: anarchivist/pyflag
 def __getitem__(self, item):
     return smart_unicode(self.attributes[item.lower()], self.charset[0],'ignore')
コード例 #6
0
ファイル: HTML.py プロジェクト: anarchivist/pyflag
 def __unicode__(self):
     return smart_unicode(self.__str__(), encoding = self.charset[0])
コード例 #7
0
ファイル: HTML.py プロジェクト: johnmccabe/pyflag
 def __unicode__(self):
     return smart_unicode(self.__str__(), encoding=self.charset[0])
コード例 #8
0
ファイル: HTML.py プロジェクト: johnmccabe/pyflag
 def __getitem__(self, item):
     return smart_unicode(self.attributes[item.lower()], self.charset[0],
                          'ignore')