RPA-Python: "invalid continuation byte" error - UTF-8 and OS code page, see solution
Hello @kensoh, I am Chinese, I think there is a problem with tagui for python handling of Chinese characters, For example:
r.type('//*[@name="q"]', '撒') # google search input type test, It will cause 'invalid continuation byte'.
and
r.type('D:\input.png', '中文') # chrome input png type test, It will nothing happens and script will pending.
Mr.kensoh, Can you give me some advice? I really need your help! Thank you so much!
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 38 (20 by maintainers)
Commits related to this issue
- #451 - readme tip on non-UTF-8 OS — committed to tebelorg/RPA-Python by kensoh a year ago
Kensoh: The SikuliX engine used by rpa package does not support typing international characters.
Check this: https://github.com/tebelorg/RPA-Python/issues/451#issuecomment-1489511469
For the second problem, below are my comments:
Hi, @kensoh Mr.Kensoh, Thank you for your reply, I’ve tried both solutions, all successful!!! 👍 But I think the solution 1 is better, So I think this question can be closed. Thanks again.
By the way, Share update default chcp 437 method with others who have the same problem:
Ok @Vic-Lau would be difficult for you to test because may need to modify subprocess call too. But any clues will be helpful. When I get time and a windows PC I will test the hypothesis whether the problem-solution works.
Hi @kensoh, Mr.Kensoh, Maybe my description is wrong, When I modified tagui.py to gbk, tagui.py cannot working. So,
utf-8 value '\xe6\x92\x92' was modified to '\xe6\x92?'error is tagui.py’s result in utf-8. I still think it is possible that there is a problem with substring or replace when doing the conversion.It works on my Windows PC too :
device_encoding is gbk :
I have tested on many Windows10 OS and used many versions of Python(3.8.0, 3.8.1, 3.11.2), I believe this error
[RPA][ERROR] - 'utf-8' codec can't decode bytes in position 34-35: invalid continuation bytehas always existed, I think it may be because this error does not affect the final type() result, so no one raise the issue.PS: Mr.Kensoh, I already added your FB friend, Can you pass it? Thx.
抱歉,我还没用上 Python,这个问题给不了建议。
康轶文 13816359064
Ken Soh @.***> 于2023年4月9日周日 21:30写道:
Mr.kensoh,您所做的事情不仅有意义,而且也非常出色,就不要谦虚了,哈哈,致敬。