bytes vs. characters
bytes vs. characters
Posted Apr 16, 2015 22:36 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)In reply to: bytes vs. characters by zyga
Parent article: Report from the Python Language Summit
> If you have mixed encoding just frelling use BYTES as that's what you are reading anyway. Bytes. Use bytes and be happy.
Except that you can't do it.
Except that you can't do it.
For example, JSON decoder in Python3 _insists_ on decoding strings as strings. Even if they have invalid UTF-8 data. It's bad, but such services do exist out there and sometimes you have to work with them.
Ditto for HTTP headers.
