Giter Site home page Giter Site logo

Comments (4)

dampcake avatar dampcake commented on June 20, 2024

I am trying to understand how this is formatted. Right now parsing it manually by hand to JSON:

{
  "interval": 900,
  "peers": "ip",
  "213.49.181.984": "port", // also this is not a valid IP address
  //This is where it fails. A number cannot be a key in a bencode dict
}

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.

from bencode.

blanexie avatar blanexie commented on June 20, 2024

请考虑下中文编码的问题, 还有种子文件中的pieces字段的值

  1. Consider Chinese encoding

  2. torrent --> info --> pieces

from bencode.

dampcake avatar dampcake commented on June 20, 2024

@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?

from bencode.

blanexie avatar blanexie commented on June 20, 2024

thanks , It's normal to run.

  1. useBytes : true
  2. ByteBuffer to convert into String

kotlin code

val bencode = Bencode(charset("utf8"), true)


 UTF8.decode((infoMap["name"] as ByteBuffer)).toString()

from bencode.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.