您使用
enpre("utf-8")不正确。Python字节字符串(str类型)具有编码,而Unipre没有。您可以使用将Unipre字符串转换为Python字节字符串
uni.enpre(encoding),也可以使用
s.depre(encoding)(或等效于
unipre(s,encoding))将字节字符串转换为Unipre字符串。
如果
fullFilePath和
path当前是
str类型,则应该弄清楚它们是如何编码的。例如,如果当前编码为utf-8,则可以使用:
path = path.depre('utf-8')fullFilePath = fullFilePath.depre('utf-8')如果这不能解决问题,则实际的问题可能是您未在
execute()呼叫中使用Unipre字符串,请尝试将其更改为以下内容:
cur.execute(u"update docs set path = :fullFilePath where path = :path", locals())



