raimon49 / pip-licenses

Dump the license list of packages installed with pip.
MIT License
307 stars 43 forks source link

Escape unicode output (to e.g. {) in the html output #139

Closed timw6n closed 1 year ago

timw6n commented 1 year ago

This should fix broken author names etc. when viewing the output in browser.

My current workflow is to save the --format html output from pip-licenses straight to a file. To have non-broken author names when viewing that in a browser, need to either wrap the output in a full html document that sets an encoding or, as I'm doing now, pipe through python -c "import sys; s = sys.stdin.read(); print(s.encode('ascii', errors='xmlcharrefreplace').decode('ascii'))" which is basically the change in this PR.

It feels better to add this here, rather than upstream in prettytable, since that package works fine outputting utf-8 in the context of including tables in larger documents.

codecov[bot] commented 1 year ago

Codecov Report

Merging #139 (6f1737e) into master (8d0c114) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #139   +/-   ##
=======================================
  Coverage   99.73%   99.73%           
=======================================
  Files           1        1           
  Lines         377      378    +1     
=======================================
+ Hits          376      377    +1     
  Misses          1        1           
Impacted Files Coverage Δ
piplicenses.py 99.73% <100.00%> (+<0.01%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

raimon49 commented 1 year ago

v4.0.3 is available. https://pypi.org/project/pip-licenses/4.0.3/