Fix `_idna_encode()` detection of an ASCII hostname for `\x080`
ADD
changelog/2901.bugfix.rst
+Corrected a sign error in a check for whether a character is in the ASCII range.

MODIFY
src/urllib3/util/url.py
src/urllib3/util/url.py
@@ -330,7 +330,7 @@ def _normalize_host(host: str | None, scheme: str | None) -> str | None:
def _idna_encode(name: str) -> bytes:
- if name and any([ord(x) > 128 for x in name]):
+ if not name.isascii():
try:
import idna
except ImportError:

Fix `_idna_encode()` detection of an ASCII hostname for `\x080`