wxBot
wxBot copied to clipboard
联系人昵称中有emoji时报错
[MSG] Roger,Standby。: [ERROR] Except in proc_msg Traceback (most recent call last): File "E:\wxbot\wxbot.py", line 618, in proc_msg self.handle_msg(r) File "E:\wxbot\wxbot.py", line 588, in handle_msg content = self.extract_msg_content(msg_type_id, msg) File "E:\wxbot\wxbot.py", line 436, in extract_msg_content print ' %s[Text](illegal text).' % msg_prefix UnicodeEncodeError: 'gbk' codec can't encode character u'\ud83d' in position 4: illegal multibyte sequence
+1 楼主后来解决了吗?
这个问题是你windows终端的问题,windows终端使用的gbk编码,而unicode编码的emoji在转gbk时会报错,因为gbk没有对应的字符集。想解决这个问题可以作个emoji的过滤函数,将emoji的字符给过滤掉。或者就是换个支持utf-16的终端来运行。