STINNER Victor added the comment: Note: it is not possible to reencode the buffer of decoded characters to compute the offset in bytes. Some codecs are not bijective.
Examples: * b'\x00'.decode('utf7').encode('utf7') == b'+AAA-' * b'\xff'.decode('ascii', 'replace').encode('ascii', 'replace') == b'?' * b'\xff'.decode('ascii', 'ignore').encode('ascii', 'ignore') == b'' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15216> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com