Skip to content

Commit e7a0c72

Browse files
authored
ignore utf-8 errors (#244)
The compiler will warn about the following code, but crytic-compile fails before it logs the compiler warning. Now, users will see the compiler warning of invalid syntax instead of an encoding error. ```contract C { string s = unicode"�"; }```
1 parent 542c719 commit e7a0c72

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crytic_compile/platform/solc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,10 @@ def _run_solc(
520520
# pylint: disable=raise-missing-from
521521
raise InvalidCompilation(error)
522522
stdout_, stderr_ = process.communicate()
523-
stdout, stderr = (stdout_.decode(), stderr_.decode()) # convert bytestrings to unicode strings
523+
stdout, stderr = (
524+
stdout_.decode(encoding="utf-8", errors="ignore"),
525+
stderr_.decode(encoding="utf-8", errors="ignore"),
526+
) # convert bytestrings to unicode strings
524527

525528
if stderr and (not solc_disable_warnings):
526529
LOGGER.info("Compilation warnings/errors on %s:\n%s", filename, stderr)

0 commit comments

Comments
 (0)