-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bencode should support [u8] lookups #60
Comments
Thanks for bringing this up. This was a case of me misinterpreting the specification. I read that dictionary keys had to be strings, and then read that metainfo file dictionary keys must be UTF-8 and ended up conflating the two. At the time, I figured the specification was just loosely worded (as it tends to be), but it seems reasonable that bencode dictionary keys don't have to be UTF-8. Luckily this should be an easy fix, I believe most of the dependency on the I will probably push a fix by tomorrow. |
Some clients do not format
I know about rust only for about an hour or two, so I absolutely can't help you with a PR or a possible solution to this problem just yet (: You can download a "test suite" of torrent files that I'm analysing (many have non-UTF-8 strings) -- cumulatively 50k .torrent files -- via rsync from the following two servers:
By the way, does bip_metainfo support V2 torrents as well? |
This issue is about But if you want to handle non-utf8 filenames then yeah, bip_metainfo seems to do the wrong thing at the moment and you'll have to drop to a lower level, using |
Thank you for the reply! |
Rust strings must be valid utf8. Bencoding is a binary format where keys are primarily binary data which just usually happen to be ascii or utf8.
In some cases they do not represent valid utf8 sequences. E.g. HTTP scrape responses contain binary infohashes as dictionary keys.
The text was updated successfully, but these errors were encountered: