Message217055
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. |
|
Date |
User |
Action |
Args |
2014-04-23 06:42:48 | Sworddragon | set | recipients:
+ Sworddragon, lemburg, ncoghlan, vstinner, ezio.melotti, r.david.murray |
2014-04-23 06:42:48 | Sworddragon | set | messageid: <1398235368.19.0.430978418857.issue21331@psf.upfronthosting.co.za> |
2014-04-23 06:42:48 | Sworddragon | link | issue21331 messages |
2014-04-23 06:42:47 | Sworddragon | create | |
|