def urltoutf8(string):
""""""
g_code_type = ['utf-8', 'utf8', 'gb18030', 'gb2312', 'gbk', 'iso-8859-2']
try:
tmp = urllib.unquote(str(string))
code = chardet.detect(tmp)['encoding']
try:
g_code_type.index(code.lower())
tmp = tmp.decode(code)
except:
try:
tmp = tmp.decode('utf8')
except:
tmp = tmp.decode('gb18030')
except:
tmp = json.dumps(string)
tmp = tmp.replace(u'"','')
pass
tmp = tmp.replace(u'\xa0',' ')
return tmp
用户登录
还没有账号?立即注册
用户注册
投稿取消
| 文章分类: |
|
还能输入300字
上传中....
温州皮革厂老板黄河