1.原始robot framework的代码:“风险点1-工作年限”求得长度为11
2.用Encode String To Bytes处理 ,求得长度为25
处理后:
3.Encode String To Bytes用法:
Encode String To Bytes |
string, encoding,errors=strict |
Encodes the given Unicode string to bytes using the given encoding .
errors argument controls what to do if encoding some characters fails. All values accepted by encode method in Python are valid, but in practice the following values are most useful:
strict : fail if characters cannot be encoded (default)
ignore : ignore characters that cannot be encoded
replace : replace characters that cannot be encoded with a replacement character
Examples:
${bytes} = |
Encode String To Bytes |
${string} |
UTF-8 |
|
${bytes} = |
Encode String To Bytes |
${string} |
ASCII |
errors=ignore |
Use Convert To Bytes in BuiltIn if you want to create bytes based on character or integer sequences. Use Decode Bytes To String if you need to convert byte strings to Unicode strings and Convert To String in BuiltIn if you need to convert arbitrary objects to Unicode.
|