-
Notifications
You must be signed in to change notification settings - Fork 16
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
Decode exception when decoding string from http://bttracker.debian.org/ #10
Comments
I am trying to understand how this is formatted. Right now parsing it manually by hand to JSON:
I have also tried running it through a some other bencode parsers and they all fail at the same spot. Are you actually able to get it decode with anything? As far as I can tell it is malformed. If you are able to get it to decode please let me know. My guess is that the peers are supposed an array of dictionaries as that is what would make the most logic sense but that is not what the data specifies. |
请考虑下中文编码的问题, 还有种子文件中的pieces字段的值
|
@blanexie Chinese characters should parse fine as long as you pass a Charset that can understand them. Do you have an example of valid bencode formatting with those characters in a string that is not parsing correctly? |
thanks , It's normal to run.
kotlin code val bencode = Bencode(charset("utf8"), true)
UTF8.decode((infoMap["name"] as ByteBuffer)).toString()
|
I also have |
Hi,
Just found may be an issue, when I try to use bencode.decode some string from debian bttracker, always got exception.
How to reproduce:
Make a get call use following url:
http://bttracker.debian.org:6969/announce?info_hash=N%f5%ad%16%c0%9e%b5%0b%8c%3b%90~%02u%24%eeC%ad%ad%01&peer_id=%ff%fe%fd%fc%fb%fa%f9%f8%f7%f6%f5%f4%f3%f2%f1%f0%ef%ee%ed%ec&port=6881&uploaded=0&downloaded=0&left=659554304%22
then will get following UTF_8 String back:
"d8:intervali900e5:peers2:ip13:213.49.181.984:porti6881e2:ip14:216.195.129.274:porti6881e2:ip12:146.71.73.214:porti6881e2:ip12:146.71.73.514:porti6881eee"
When I try to decode the above string,
then got an exception:
"Unexcept token 'i'"
I try to debug it, then found out that "d8:" these 3 chars are ok, till the fourth chars "i", then got the exception.
I just want to confirm, if it is the string encode problem? or something else?
btw: Env: Java 11, Mac OS. I use the example string in the README.md, the decoding works fine.
Thank you for your help!
best regards
Mike
The text was updated successfully, but these errors were encountered: