(s)
Return True if s contains surrogate-escaped binary data.
Return True if s contains surrogate-escaped binary data.
Return True if s contains surrogate - escaped binary data .
def _has_surrogates(s):
    """Return True if s contains surrogate-escaped binary data."""
    # This check is based on the fact that unless there are surrogates, utf8
    # (Python's default encoding) can encode any string.  This is the fastest
    # way to check for surrogates, see issue 11454 for timings.
    try:
        s.encode()
        return False
    except UnicodeEncodeError:
        return True
def _has_surrogates ( s ) : # This check is based on the fact that unless there are surrogates, utf8 # (Python's default encoding) can encode any string.  This is the fastest # way to check for surrogates, see issue 11454 for timings. try : s . encode ( ) return False except UnicodeEncodeError : return True