小编Cap*_*ens的帖子

UnicodeDecodeError:'ascii'编解码器无法解码位置23的字节0xc3:序数不在范围内(128)

当我尝试连接它时,当字段包含'ñ'或'''时,我得到UnicodeDecodeError.如果包含'ñ'或'''的字段是最后一个我没有收到错误.

#...

nombre = fabrica
nombre = nombre.encode("utf-8") + '-' + sector.encode("utf-8")
nombre = nombre.encode("utf-8") + '-' + unidad.encode("utf-8")

#...

return nombre 
Run Code Online (Sandbox Code Playgroud)

任何的想法?非常感谢!

python encoding utf-8

46
推荐指数
2
解决办法
15万
查看次数

标签 统计

encoding ×1

python ×1

utf-8 ×1