Sworddragon added the comment: The documentation says that unicode_internal is deprecated since Python 3.3 but not unicode_escape. Also, isn't unicode_escape different from utf-8? For example my original intention was to convert 2 byte string characters to their control characters. For example the file test.txt contains the 17 byte utf-8 raw content "---a---\n---ä---". Now I want to convert '\\n' to '\n':
>>> file = open('test.txt', 'r') >>> content = file.read() >>> file.close() >>> content = content.encode('utf-8').decode('unicode-escape') >>> print(content) ---a--- ---ä--- I'm getting now successfully 2 lines but I have noticed not getting the ä anymore. After that I have made a deeper look and opened this ticket. If unicode_escape gets really deprecated maybe I could simply replace the characters 0-31 and 127 to achieve practically the same behavior. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21331> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com