且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

机器人框架 - UnicodeDecodeError:'ascii' 编解码器无法解码位置 49 中的字节 0xe9:输入文本时序号不在范围内(128)

更新时间:2022-04-30 03:20:19

这是 py2 我怀疑将是您使用的变量的实际类型 (value);它可能是带有编码形式的高位 ascii 字符的字节串.

This being py2 my suspect would be the actual type of the variable you use (value); it may be a bytestring with the high-ascii characters in encoded form.

Input Text中使用之前,将其转换为unicode:

Just before using it in Input Text, convert it to unicode:

${value}=    Decode Bytes To String    ${value}

如果失败 - 或者它没有产生想要的结果,请尝试使用 Convert To String:

If that fails - or it doesn't produce the desired result, try with Convert To String:

${value}=    Convert To String    ${value}

我怀疑后者会以编码形式保留违规"字符,例如D\xe9cor".请在评论中告诉我,我很好奇:)

I suspect the latter though will preserve the "offending" characters in their encoded form, e.g. "D\xe9cor". Do let me know in the comments, I'm quite curious :)