django-tables2:使用unicode进行模板渲染

时间:2015-12-10 08:56:45

标签: django django-tables2

def html_decode(s):
    htmlCodes = (
            ("'", '''),
            [...]
            ('é', 'é')
        )
    for code in htmlCodes:
        s = s.replace(code[1], code[0])
    return s

class WordsTable(tables.Table):
    [...]
    def render_bibl(self, value):
        return html_decode(value)

我正在解码该列,因为它包含äé之类的内容。这样做时,django-tables2给出了以下错误:The string that could not be encoded/decoded was: ��

0 个答案:

没有答案