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)
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)
相关文章推荐
- jQuery plugin items filter
- 全国哀悼日网站页面变成灰色的filter方法
- 用css filter做鼠标滑过图片效果
- 将编码从GB2312转成UTF-8的方法汇总(从前台、程序、数据库)
- UTF-8、Unicode 标准化表单、BOM
- ASP UTF-8页面乱码+GB2312转UTF-8 +生成UTF-8格式的文件(编码)第1/2页
- ASP 使用Filter函数来检索数组的实现代码
- ASP+FSO生成的网页文件默认编码格式以及转换成UTF-8编码方法
- php中json_encode UTF-8中文乱码的更好解决方法
- ASP.NET MVC:Filter和Action的执行介绍
- php utf-8转unicode的函数第1/2页
- django中使用jquery ajax post数据出现403错误的解决办法(两种方法)
- django使用ajax post数据出现403错误如何解决
- JSP Filter的应用方法
- utf-8编码引起js输出中文乱码的解决办法
- Shell脚本把文件从GBK转为UTF-8编码
- PHP中实现Bloom Filter算法
- jq的get传参数在utf-8中乱码问题的解决php版
- php UTF-8、Unicode和BOM问题
- php中文乱码怎么办如何让浏览器自动识别utf-8