You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bencoded files can, and in their most common use case do, include raw binary data. The native string type in python 2 is just binary data (str). This means loading a torrent file, and decoding it with python 2 works just fine with bencode.py (as it uses uses the native string type exclusively internally).
In python 3, the native string type is a sequence of unicode code points, not bytes, and never the twain shall they meet. So while a unicode string (python 3 str) will encode and decode just fine with bencode.py, it cannot decode or encode a bytes structures. ...And you need to be able to do that to handle torrent files (which cannot be represented in unicode - there is raw binary in the file)
The text was updated successfully, but these errors were encountered:
bencoded files can, and in their most common use case do, include raw binary data. The native string type in python 2 is just binary data (str). This means loading a torrent file, and decoding it with python 2 works just fine with bencode.py (as it uses uses the native string type exclusively internally).
In python 3, the native string type is a sequence of unicode code points, not bytes, and never the twain shall they meet. So while a unicode string (python 3 str) will encode and decode just fine with bencode.py, it cannot decode or encode a bytes structures. ...And you need to be able to do that to handle torrent files (which cannot be represented in unicode - there is raw binary in the file)
The text was updated successfully, but these errors were encountered: