fcavallarin / htcap

htcap is a web application scanner able to crawl single page application (SPA) recursively by intercepting ajax calls and DOM changes.
GNU General Public License v2.0
610 stars 114 forks source link

Encoding should be changed in 'report' section from system-specific to standart UTF-8 #86

Closed kubikrubikvkube closed 1 year ago

kubikrubikvkube commented 3 years ago

As mentioned in Python <=3.8 documentation

The default encoding is platform dependent (whatever locale.getpreferredencoding() returns)

When report tool is started on OS with environment encoding different from UTF-8 (CP-1252 for example), following error is occured

  File "C:\Users\kubikrubikvkube\dev\htcap_forked\htcap\htcap.py", line 83, in <module>
    Util(argv[1:], dbfile)
  File "C:\Users\kubikrubikvkube\dev\htcap_forked\htcap\core\util\util.py", line 43, in __init__
    run(args, util)
  File "C:\Users\kubikrubikvkube\dev\htcap_forked\htcap\core\util\base_util.py", line 61, in __init__
    self.main(args, opts, db_file)
  File "C:\Users\kubikrubikvkube\dev\htcap_forked\htcap\core\util\utilities\report.py", line 229, in main
    html = base_html % (css.read(), jsn, js.read(), html.read())
  File "C:\Users\kubikrubikvkube\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 5744: character maps to <undefined>

Process finished with exit code 1

I propose to not use platform dependent encoding, but always generate report in UTF-8 encoding.

kubikrubikvkube commented 2 years ago

Any updates on this pull request? It's been 2 years so far.