def METHOD_NAME(cls) -> None:
    """Ensure the locale uses UTF-8 encoding, or prompt for an explicit bypass."""
    encoding = locale.getpreferredencoding()
    if (
        encoding.lower() != "utf-8"
        and os.environ.get(IGNORE_UNRECOGNIZED_ENCODING, None) is None
    ):
        raise RuntimeError(
            softwrap(
                f"""
                Your system's preferred encoding is `{encoding}`, but Pants requires `UTF-8`.
                Specifically, Python's `locale.getpreferredencoding()` must resolve to `UTF-8`.
                You can fix this by setting the LC_* and LANG environment variables, e.g.:
                  LC_ALL=en_US.UTF-8
                  LANG=en_US.UTF-8
                Or, bypass it by setting {IGNORE_UNRECOGNIZED_ENCODING}=1. Note that
                pants may exhibit inconsistent behavior if this check is bypassed.
                """
            )
        )