littlecodersh / littlecodersh/ItChat

UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-54: ordinal not in range(128)

Open
#682 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
26.5k
Forks
5.6k
PR merge metrics
No merged PRs in 30d

Description

在提交前,请确保您已经检查了以下内容!

  • 您可以在浏览器中登陆微信账号,但不能使用itchat登陆
  • 我已经阅读并按文档 中的指引进行了操作
  • 您的问题没有在issues报告,否则请在原有issue下报告
  • 本问题确实关于itchat, 而不是其他项目.
  • 如果你的问题关于稳定性,建议尝试对网络稳定性要求极低的itchatmp项目

请使用itchat.run(debug=True)运行,并将输出粘贴在下面:
Please press confirm on your phone.
Traceback (most recent call last):
File "ItChat.py", line 30, in
itchat.auto_login(True)
File "/usr/local/python2.7.15/lib/python2.7/site-packages/itchat/components/register.py", line 32, in auto_login
loginCallback=loginCallback, exitCallback=exitCallback)
File "/usr/local/python2.7.15/lib/python2.7/site-packages/itchat/components/login.py", line 53, in login
status = self.check_login()
File "/usr/local/python2.7.15/lib/python2.7/site-packages/itchat/components/login.py", line 137, in check_login
if process_login_info(self, r.text):
File "/usr/local/python2.7.15/lib/python2.7/site-packages/itchat/components/login.py", line 172, in process_login_info
for node in xml.dom.minidom.parseString(r.text).documentElement.childNodes:
File "/usr/local/python2.7.15/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
return expatbuilder.parseString(string)
File "/usr/local/python2.7.15/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
return builder.parseString(string)
File "/usr/local/python2.7.15/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-54: ordinal not in range(128)

[在这里粘贴完整日志]

您的itchat版本为:[在这里填写版本号]。(可通过python -c "import itchat;print(itchat.__version__)"获取)

其他的内容或者问题更详细的描述都可以添加在下面:

[您的内容]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the login flow at itchat/components/login.py, especially process_login_info around line 172, and reproduce it from ItChat.py using Python 2.7.15 and itchat.run(debug=True). Done means the reported UnicodeEncodeError no longer occurs while processing the login response.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.