我正在从数据库中检索一些文本,在使用python3时,我看到了如下错误:
forgelogger\\n print("%s | %s" % (time.strftime("%Y-%m-%d %H:%M:%S"), message))\\nUnicodeEncodeError: \\'ascii\\' codec can\\'t encode character \\'\\\\xad\\' in position 62: ordinal not in range(128)'
之后,我尝试按原样使用变量,并尝试.encode()
,但随后我得到:
我也尝试过使用.decode()
,但是:
AttributeError: \\'str\\' object has no attribute \\'decode\\''
我看不出哪个角色有问题。在
这曾经在python2上与unicode()
一起工作,但现在不行了。
有什么建议吗?在
编辑: 如果有帮助,这是Trac的配置(我们正在查询的是它的数据库):
default_charset = iso-8859-15
目前没有回答
相关问题 更多 >
编程相关推荐