#redis 中取出的缓存数据
type(content)
<type 'str'>
import chardet
chardet.detect(content)
{'confidence': 0.99, 'encoding': 'utf-8'} #编码还是utf-8
#msyql取出的字段数据
type(content)
<type 'unicode'>if isinstance(content, unicode):
content = content.encode(charset)
elif isinstance(content, str):
content = content.decode("utf-8").encode(charset)本文出自 “orangleliu笔记本” 博客,转载请务必保留此出处http://blog.csdn.net/orangleliu/article/details/41445947
作者orangleliu 采用署名-非商业性使用-相同方式共享协议
[python]mysql数据缓存到redis中 取出时候编码问题
原文地址:http://blog.csdn.net/orangleliu/article/details/41445947