您的位置:首页 > 编程语言 > Go语言

django的template中怎样进行gbk到utf-8的转码,建立一个filter

2016-03-09 19:25 471 查看
from django import template

register = template.Library()

def decodeGBKencodeUTF8(value): # Only one argument.

    """Converts a string into all lowercase"""

    return value.decode("GBK").encode("utf-8")

register.filter('decodeGBKencodeUTF8', decodeGBKencodeUTF8)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  django filter utf-8