(s)
return re.sub(r'[\u0080-\u0099]', restore, s)
Replace C1 control characters in the Unicode string s by the
    characters at the corresponding code points in Windows-1252,
    where possible.
Replace C1 control characters in the Unicode string s by the
    characters at the corresponding code points in Windows-1252,
    where possible.
Replace C1 control characters in the Unicode string s by the characters at the corresponding code points in Windows - 1252 where possible .
def restore_characters(s):
    """Replace C1 control characters in the Unicode string s by the
    characters at the corresponding code points in Windows-1252,
    where possible.
    """
    def restore(match):
        try:
            return bytes([ord(match.group(0))]).decode('windows-1251')
        except UnicodeDecodeError:
            # No character at the corresponding code point: remove it.
            return ''
    return re.sub(r'[\u0080-\u0099]', restore, s)
def restore_characters ( s ) : def restore ( match ) : try : return bytes ( [ ord ( match . group ( 0 ) ) ] ) . decode ( 'windows-1251' ) except UnicodeDecodeError : # No character at the corresponding code point: remove it. return '' return re . sub ( r'[\u0080-\u0099]' , restore , s )