Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

老是出现gbk错误 请问怎么解决呢? #1

Open
zglaozhu opened this issue Jun 13, 2019 · 6 comments
Open

老是出现gbk错误 请问怎么解决呢? #1

zglaozhu opened this issue Jun 13, 2019 · 6 comments

Comments

@zglaozhu
Copy link

使用命令py -3 JSFinder.py -u https://www.mi.com -d -ou mi_url.txt -os mi_subdomain.txt
老是出现
Traceback (most recent call last):
File "JSFinder.py", line 247, in
giveresult(urls, args.url)
File "JSFinder.py", line 221, in giveresult
print(url)
UnicodeEncodeError: 'gbk' codec can't encode character '\u200b' in position 81: illegal multibyte sequence

@Threezh1
Copy link
Owner

https://blog.csdn.net/jim7424994/article/details/22675759
参考一下这个。

@zglaozhu
Copy link
Author

谢谢你
但是研究了半天 在代码前面增加
import io

sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8') #
sys.stdout = io.TextIOWrapper( sys.stdout.buffer, encoding='gb18030')
改变标准输出的默认编码
还是没什么用

我太菜了

@Threezh1
Copy link
Owner

应该是本地python的编码有问题,实在不行的话就把print(url)那一整段都删了吧,输出的时候使用-ou和-os命令。具体看README文件。

@zglaozhu
Copy link
Author

删除了还是 失败 我用https://blog.csdn.net/jim7424994/article/details/22675759中的列子

import urllib.request
res=urllib.request.urlopen('http://www.baidu.com')
htmlBytes=res.read()
print(htmlBytes.decode('utf-8'))
报错

import io
import sys
import urllib.request
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8') #改变标准输出的默认编码
res=urllib.request.urlopen('http://www.baidu.com')
htmlBytes=res.read()
print(htmlBytes.decode('utf-8'))

正常输出

但是修改到JSFinder.py 就没有用

@Threezh1
Copy link
Owner

尝试用kali运行?实在不行的话,我也没办法。

@PLAPAP
Copy link

PLAPAP commented Jun 16, 2019

Traceback (most recent call last):
File "JSFinder.py", line 6, in
import requests, argparse, sys, re
ModuleNotFoundError: No module named 'requests'
这个错误是怎么回事 用的python3.6运行的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants