securesauce / precli

Precaution CLI - command line static application security testing tool
https://precli.readthedocs.io/
Other
21 stars 3 forks source link

Handle non-UTF-8 encoding files #477

Closed ericwb closed 4 months ago

ericwb commented 4 months ago

Python files default to be encoded in UTF-8, but they don't have to be. At the head of Python file, you can define the encoding.

This change modifies the convenience function of the Node to return a str object in the encoding of the file, honoring this header and defaulting to utf-8.

See: https://docs.python.org/3/howto/unicode.html#unicode-literals-in-python-source-code

Fixes: #468 Fixes: #473 Fixes: #472