Serhiy Storchaka added the comment: These functions are trivial.
def has_escaped_bytes(s): try: s.encode() return False except UnicodeEncodeError: return True def replace_escaped_bytes(s): return s.encode('utf-8', 'replace').decode() ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18814> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com