Skip to content

UnicodeEncodeError: 'ascii' codec can't encode characters in position 17-20: ordinal not in range(128) #271

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

Closed
rhinoceros opened this issue Nov 27, 2019 · 2 comments

Comments

@rhinoceros
Copy link

rhinoceros commented Nov 27, 2019

environment info

detect-secrets --version
0.13.0
python -V
Python 2.7.6
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"

When I execute the command detect-secrets -v scan , I get an error

Checking file: doc/management/dependencies.md
Traceback (most recent call last):
  File "/usr/local/bin/detect-secrets", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/detect_secrets/main.py", line 60, in main
    word_list_hash,
  File "/usr/local/lib/python2.7/dist-packages/detect_secrets/main.py", line 180, in _perform_scan
    should_scan_all_files=args.all_files,
  File "/usr/local/lib/python2.7/dist-packages/detect_secrets/core/baseline.py", line 83, in initialize
    output.scan_file(file)
  File "/usr/local/lib/python2.7/dist-packages/detect_secrets/core/secrets_collection.py", line 234, in scan_file
    self._extract_secrets_from_file(f, filename_key)
  File "/usr/local/lib/python2.7/dist-packages/detect_secrets/core/secrets_collection.py", line 340, in _extract_secrets_from_file
    results.update(plugin.analyze(f, filename))
  File "/usr/local/lib/python2.7/dist-packages/detect_secrets/plugins/base.py", line 129, in analyze
    is_verified = self.verify(result.secret_value, content=str(snippet))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 17-20: ordinal not in range(128)

The content of the file doc/management/dependencies.md is

# 依赖

## PostgresQL

测试环境
url: jdbc:postgresql://pgm-12xa.pg.rds.aliyuncs.com:3433/xx_tag
username: xx_tag
password: 2d4vP67t

@rhinoceros
Copy link
Author

when I use python3.6.
there is no problem.

@domanchi
Copy link
Contributor

domanchi commented Dec 2, 2019

Might be a fair example for #260.

killuazhu pushed a commit to IBM/detect-secrets that referenced this issue May 28, 2020
killuazhu pushed a commit to IBM/detect-secrets that referenced this issue Jul 9, 2020
killuazhu pushed a commit to IBM/detect-secrets that referenced this issue Sep 17, 2020
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

2 participants