Skip to content

Bug: generating report on windows fails when contains chinese symbols #918

@alysenko-nn

Description

@alysenko-nn

Pre-submission checks

  • I am not filing an auditing error (false positive or negative). These must be reported to pypa/advisory-database instead.
  • I agree to follow the PSF Code of Conduct.
  • I have looked through the open issues for a duplicate report.

Expected behavior

Pip audit generates a report successfully.

Actual behavior

Report fails when the vulnerability contains Chinese symbols

Reproduction steps

Windows 10 Home
run: pip-audit -r reqs.txt

reqs.txt contains:

tensorflow==2.10.0

GHSA-cqvq-fvhr-v6hc
In positions 54306-54308, this line 刘力源

Logs

[2025-07-18T17:22:58.899Z] Traceback (most recent call last): 
[2025-07-18T17:22:58.899Z]   File "C:\Users\Demo\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main  
[2025-07-18T17:22:58.899Z]   return _run_code(code, main_globals, None,  
[2025-07-18T17:22:58.899Z]   File "C:\Users\Demo\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code  
[2025-07-18T17:22:58.899Z]   exec(code, run_globals)  
[2025-07-18T17:22:58.899Z]   File "C:\Users\Demo\AppData\Local\Temp\brainconverter-nightly-venv\Scripts\pip-audit.exe\__main__.py", line 7, in <module>  
[2025-07-18T17:22:58.899Z]   File "C:\Users\Demo\AppData\Local\Temp\brainconverter-nightly-venv\lib\site-packages\pip_audit\_cli.py", line 620, in audit  
[2025-07-18T17:22:58.899Z]   print(formatter.format(result, fixes), file=io)  
[2025-07-18T17:22:58.899Z]   File   "C:\Users\Demo\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 19, in encode  
[2025-07-18T17:22:58.899Z]   return codecs.charmap_encode(input,self.errors,encoding_table)[0]  
[2025-07-18T17:22:58.899Z] UnicodeEncodeError: 'charmap' codec can't encode characters in position 54306-  54308: character maps to <undefined>

Additional context

It could be fixed by change cp1252 to utf8 in windows: set PYTHONUTF8=1

OS name, version, and architecture

Windows 10 home

pip-audit version

2.9.0

pip version

25.0.1

Python version

3.9

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions