Skip to content

Commit

Permalink
make sure utf-7 is not "detected" without a mark/sig
Browse files Browse the repository at this point in the history
conflict with ascii detector. cannot enable it without compromises.
  • Loading branch information
Ousret committed Aug 21, 2022
1 parent f119e43 commit 216d1c6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charset_normalizer/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ def from_bytes(
encoding_iana,
)
continue
if encoding_iana in {"utf_7"} and not bom_or_sig_available:
logger.log(
TRACE,
"Encoding %s won't be tested as-is because detection is unreliable without BOM/SIG.",
encoding_iana,
)
continue

try:
is_multi_byte_decoder: bool = is_multi_byte_encoding(encoding_iana)
Expand Down

0 comments on commit 216d1c6

Please sign in to comment.